I am trying to perform the following pg-promise query, but receive the error
Loose request outside of an expired connection
The query actually succeeds, but, even so, I would like to get rid of the error message.
The pg-promise query
db.task(t => {
t.oneOrNone(queries.insertUser, [profile.id])
.then(id =>{
if (id) {
t.none(queries.insertUserGoogle, [
profile.id,
profile.emails[0].value,
profile.name.givenName,
profile.name.familyName,
profile.displayName
])
}})
.catch(err => console.log(err))
The SQL
const insertUser = `INSERT INTO users (google_id)
VALUES ($1)
ON CONFLICT (google_id) DO NOTHING
RETURNING user_id`;
const insertUserGoogle = `INSERT INTO users_google (google_id, email, first_name, last_name, display_name)
VALUES ($1, $2, $3, $4, $5)`;
via Matt
No comments:
Post a Comment