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
Unhandled rejection TypeError: Cannot read property 'query' of undefined #9218
Still trying to reproduce, but I periodically see this error during Resource Timeout events:
Unhandled rejection TypeError: Cannot read property 'query' of undefined
at parameters.length.Promise (/sequelize/lib/dialects/postgres/query.js:65:54)
at Promise._execute (/sequelize/node_modules/bluebird/js/release/debuggability.js:300:9)
at Promise._resolveFromExecutor (/sequelize/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/sequelize/node_modules/bluebird/js/release/promise.js:79:10)
at Query.run (/sequelize/lib/dialects/postgres/query.js:65:9)
at Promise.try.then.connection (/sequelize/lib/sequelize.js:558:20)
at tryCatcher (/sequelize/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/sequelize/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/sequelize/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromiseCtx (/sequelize/node_modules/bluebird/js/release/promise.js:606:10)
at Async._drainQueue (/sequelize/node_modules/bluebird/js/release/async.js:138:12)
at Async._drainQueues (/sequelize/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/sequelize/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5)
This is similar to #8087, but since a fix for that has been merged the error must come from a different source.
options.transaction.connection is undefined at this point, but transaction is not yet finished. After we return from this promise, finished is rollback. Could be a race condition?
Seems very similar to #8087, but I've confirmed I have the fix from #9051.
We just saw this in production also. I tried adding @sushantdhiman testcase from #8087 (comment), but does correctly throw a TimeoutError and there is no unhandled rejection.
Now you should see ConnectionAcquireTimeoutError when transaction is unable to acquire connection along with proper error Transaction cannot be rolled back because it never started when such transaction try to rollback
Activity
gabegorelick commentedon Mar 22, 2018
Tracked the issue down to this:
sequelize/lib/sequelize.js
Lines 552 to 554 in 20cac7a
options.transaction.connectionisundefinedat this point, but transaction is not yet finished. After we return from this promise,finishedisrollback. Could be a race condition?Seems very similar to #8087, but I've confirmed I have the fix from #9051.
sushantdhiman commentedon Mar 23, 2018
Last I tried my testcase was still throwing that error with current fix, may be that test case represent your case as well
itsmepetrov commentedon Apr 25, 2018
Any updates?
mattmackay76 commentedon May 15, 2018
I'm getting this issue on Sequelize version: 4.37.7
Anybody have any ideas on this?
picq commentedon Jun 4, 2018
This issue still exists, does anybody have a clue how fix it ?
omguhh commentedon Jul 19, 2018
Any update on this?
bjitfreelancing commentedon Jul 28, 2018
Even I am facing same issue with "pg": "^7.4.3", "sequelize": "^4.37.7"
holm commentedon Aug 6, 2018
We just saw this in production also. I tried adding @sushantdhiman testcase from #8087 (comment), but does correctly throw a TimeoutError and there is no unhandled rejection.
hackhat commentedon Sep 1, 2018
Still happening, any news?
fix(transaction): fixed "Cannot read property 'query' of undefined" e…
fix(transaction): fixed unhandled rejection when connection acquiring…
sushantdhiman commentedon Sep 7, 2018
Resolved by #9879
Now you should see
ConnectionAcquireTimeoutErrorwhen transaction is unable to acquire connection along with proper errorTransaction cannot be rolled back because it never startedwhen such transaction try to rollbackEdit: Released as 5.0.0-beta.12
soryy708 commentedon Feb 10, 2019
Somehow I got the same error by misusing transactions.
Here's code to reproduce:
Note that the transaction is inside an unnecessary object.
Probably should not be fixed by sequelize, but may be useful for people doing debugging.