TypeError: Cannot call method 'findOne' of undefined
PandaWhisperer opened this issue · 1 comments
PandaWhisperer commented
I'm trying to revive an older Meteor project that I have. It's currently crashing on startup with this error:
W20160312-18:28:45.691(-8)? (STDERR) TypeError: Cannot call method 'findOne' of undefined
W20160312-18:28:45.691(-8)? (STDERR) at Object.Migrations._getControl (packages/percolate_migrations/migrations_server.js:245:1)
W20160312-18:28:45.691(-8)? (STDERR) at Object.Migrations._migrateTo (packages/percolate_migrations/migrations_server.js:161:1)
W20160312-18:28:45.691(-8)? (STDERR) at Object.Migrations.migrateTo (packages/percolate_migrations/migrations_server.js:143:1)
...(redacted)
My database contains the control record:
meteor:PRIMARY> db.migrations.find()
{ "_id" : "control", "version" : 4, "locked" : false }
Not sure what's going on here. Apparently Migrations._collection
is undefined at packages/percolate_migrations/migrations_server.js:245:1
, but I can't see why.
I'm running Meteor 1.2.1
PandaWhisperer commented
Nevermind. Upon closer examination of the docs I see my error. My migrations file did not have the Migrations.migrateTo('latest')
line inside of a Meteor.startup()
callback, so it was called too early in the bootstrapping process.