question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read property '0' of undefined with pg 7

See original GitHub issue

What you are doing?

I just upgraded to Sequelize 4.4.2 and node-postgres (pg) version 7.0.2

Then, when I call sync() to connecto the db and create tables. I get an error

It happens, for example, when I run this command:

models.sequelize.sync({force: true}).

What do you expect to happen?

Sequelize should connect to Postgres and the create tables.

What is actually happening?

TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined
    at Promise.then.result (C:\test\node_modules\sequelize\lib\dialects\postgres\connection-manager.js:157:31)
    at tryCatcher (C:\test\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (C:\test\node_modules\bluebird\js\release\promise.js:512:31)
    at Promise._settlePromise (C:\test\node_modules\bluebird\js\release\promise.js:569:18)
    at Promise._settlePromise0 (C:\test\node_modules\bluebird\js\release\promise.js:614:10)
    at Promise._settlePromises (C:\test\node_modules\bluebird\js\release\promise.js:693:18)
    at Async._drainQueue (C:\test\node_modules\bluebird\js\release\async.js:133:16)
    at Async._drainQueues (C:\test\node_modules\bluebird\js\release\async.js:143:10)
    at Immediate.Async.drainQueues (C:\test\node_modules\bluebird\js\release\async.js:17:14)
    at runCallback (timers.js:651:20)
    at tryOnImmediate (timers.js:624:5)
    at processImmediate [as _immediateCallback] (timers.js:596:5)

__Dialect: postgres __Database version: 9.6.2 (pg 7.0.2) __Sequelize version: 4.4.2

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:53
  • Comments:70 (5 by maintainers)

github_iconTop GitHub Comments

55reactions
ghostcommented, Aug 5, 2017

I just installed pg@6.4.1. it may be an issue related with the support for pg ^7.0.2

28reactions
dsullivan7commented, Oct 1, 2017

I found that switching from findOrCreate to findCreateFind (documentation here) solved this issue for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is this error?: TypeError: Cannot read property '0' of ...
The error basically happens every time I click submit on the website. That's the first problem, the second is after I click submit...
Read more >
How to Prevent the Error: Cannot Read Property '0' of Undefined
A guide on how to prevent the error "cannot Read Property '0' of Undefined", covering techniques such as try, catch, using const over...
Read more >
"Cannot read property "0" from undefined" Error - ServiceNow
Hello All, The "Cannot read property "0" from undefined" error is displayed. So checked property and got this below code snippet.
Read more >
Uncaught TypeError: Cannot read property of undefined In
Uncaught TypeError : Cannot read property of undefined error occurs in Chrome when you read a property or call a method on an...
Read more >
TypeError cannot read property '0' of undefined in Pavlovia
TypeError : Cannot read properties of undefined (reading 0) ... did not press any keys at all except the space bar to move...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found