You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
retrying queries with bind/replacement/more fails #10453
This was a hard one to track down, I've been seeing this error for months and finally figured out why. I can attempt a PR but it would probably be quicker for the maintainers to take this.
On the first attempt, the sql variable is mutated so that $id becomes $1. On the second attempt, it uses the mutated SQL which treats it as an array bind - but the values passed is still an object.
The fix is to remove all mutating of outer scope variables from any retry function, so that if a retry needs to occur it is using the same inputs and not anything mutated by the last attempt.
What do you expect to happen?
It should retry without failing.
What is actually happening?
Error: Named bind parameter "$1" has no value in the given object.
at sql.replace (/Users/contra/Projects/staeco/node_modules/sequelize/lib/dialects/abstract/query.js:85:15)
at String.replace (<anonymous>)
at Function.formatBindParameters (/Users/contra/Projects/staeco/node_modules/sequelize/lib/dialects/abstract/query.js:67:22)
at Function.formatBindParameters (/Users/contra/Projects/staeco/node_modules/sequelize/lib/dialects/postgres/query.js:51:27)
at Promise.try (/Users/contra/Projects/staeco/node_modules/sequelize/lib/sequelize.js:499:44)
Dialect: postgres (but also any) Database version: 11.1 Sequelize version: v4 and v5 Tested with latest release: Yes
Note :Your issue may be ignored OR closed by maintainers if it's not tested against latest version OR does not follow issue template.
Tried not to touch anything we didn't need to - IMO this whole block probably needs to be revisited/cleaned up, it looks like a few other issues might exist in there.
Activity
yocontra commentedon Feb 17, 2019
Here's how we fixed it on our fork: yocontra@f6a2e2e
Tried not to touch anything we didn't need to - IMO this whole block probably needs to be revisited/cleaned up, it looks like a few other issues might exist in there.
yocontra commentedon Mar 3, 2019
Thank you @sushantdhiman 👍