DB Custom script (get_user): invalid fields. Expected type string but found type integer

I’m trying Database Action Scripts with simple and valid code to get user:

function loginByEmail(email, callback) {
    const postgres = require('pg');
    const client = new postgres.Client(configuration.DATABASE_URI);
    client.connect();

    const query = 'SELECT id, email FROM users WHERE email = $1';
    client.query(query, [email], function (err, result) {

        if (err || result.rows.length === 0) {
            return callback(err);
        }

        const user = result.rows[0];

        return callback(null, {
            id: user.id,
            email: user.email,
        });
    });
}

But have following error: DB Custom script (get_user): invalid fields. Expected type string but found type integer. It complains about this part “$1”, but there is no other way to do it.
I’ve also tried to pass query like this:

const query = `SELECT id, email FROM users WHERE email = ${email}`;

No luck either

What is wrong here?

Found the problem by myself. I have user ID as number, but callback function expects it as string.