Postgresql error with Knex Adapter in KeystoneJS 5: 'Error: Cannot read property 'find' of undefined'
See original GitHub issueI am new to Postgresql (more familiar with Mongo) but our DevOps want me to transition a KeystoneJS 5 project from Mongo to Postgresql. I followed the KeystoneJS instructions and all went fine until I tried adding the ‘atCreated’ plugin, specifically the ‘createdAtField’ plugin, to get a created date in my list. I started getting DB errors, and, thinking that I needed to rebuild the database, I ran the KeystoneJS init script to drop the database and rebuild it. Since then, I’ve gotten the following error:
$ tsc && cross-env NODE_ENV=development DISABLE_LOGGING=true keystone --entry=tsout/index.js dev --port=4545
ℹ Command: keystone dev --entry=tsout/index.js --port=4545
✔ Validated project entry file ./tsout/index.js
✔ Keystone server listening on port 4545
✔ Initialised Keystone instance
⠋ Connecting to databaseType "OEmbed" is missing a "__resolveType" resolver. Pass false into "resolverValidationOptions.requireResolversForResolveType" to disable this warning.
setting up cron job
⠙ Connecting to database knex:query select 1+1 as result undefined +0ms
⠹ Connecting to database knex:query SHOW server_version; undefined +65ms
✖ Connecting to database
Error: Cannot read property 'find' of undefined
at /Users/ranthony/Documents/projects/yaa-keystone/node_modules/@keystonejs/utils/dist/utils.cjs.dev.js:57:21
at async executeDefaultServer (/Users/ranthony/Documents/projects/yaa-keystone/node_modules/@keystonejs/keystone/bin/utils.js:114:3) {
errors: {
KnexAdapter: TypeError: Cannot read property 'find' of undefined
at /Users/ranthony/Documents/projects/yaa-keystone/node_modules/@keystonejs/adapter-knex/lib/adapter-knex.js:258:31
at Array.forEach (<anonymous>)
at KnexListAdapter._postConnect (/Users/ranthony/Documents/projects/yaa-keystone/node_modules/@keystonejs/adapter-knex/lib/adapter-knex.js:257:24)
at /Users/ranthony/Documents/projects/yaa-keystone/node_modules/@keystonejs/adapter-knex/lib/adapter-knex.js:73:19
at Array.forEach (<anonymous>)
at KnexAdapter.postConnect (/Users/ranthony/Documents/projects/yaa-keystone/node_modules/@keystonejs/adapter-knex/lib/adapter-knex.js:72:38)
at KnexAdapter.connect (/Users/ranthony/Documents/projects/yaa-keystone/node_modules/@keystonejs/adapter-knex/node_modules/@keystonejs/keystone/lib/adapters/index.js:29:38)
at async pReflect (/Users/ranthony/Documents/projects/yaa-keystone/node_modules/p-reflect/index.js:5:17)
at async Promise.all (index 0)
at async executeDefaultServer (/Users/ranthony/Documents/projects/yaa-keystone/node_modules/@keystonejs/keystone/bin/utils.js:114:3)
}
}
The DB is obviously empty, but I am trying to set up a new database based on the current lists using
const keystone = new Keystone({
name: PROJECT_NAME,
adapter: new KnexAdapter({ dropDatabase: true })
});
I went back to a prior branch, hoping to undo the errors (except the dropped DB of course), but the error persists. Any help much appreciated, I’m at a bit of a loss what to look for here.
My current Keystone versions are:
"@keystonejs/adapter-knex": "^7.0.0",
"@keystonejs/adapter-mongoose": "^5.2.0",
"@keystonejs/app-admin-ui": "^5.8.0",
"@keystonejs/app-graphql": "^5.1.0",
"@keystonejs/app-next": "^5.1.0",
"@keystonejs/app-static": "^5.1.0",
"@keystonejs/auth-password": "^5.1.0",
"@keystonejs/field-content": "^5.4.0",
"@keystonejs/fields": "^6.3.0",
"@keystonejs/fields-markdown": "^5.1.0",
"@keystonejs/fields-wysiwyg-tinymce": "^5.2.0",
"@keystonejs/file-adapters": "^5.5.0",
"@keystonejs/keystone": "^5.5.0",
"@keystonejs/list-plugins": "^5.1.2",
"@keystonejs/oembed-adapters": "^5.1.0",
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (4 by maintainers)
Top GitHub Comments
@DJonesCadient you’ll need to make sure all your dependencies are updated to latest. especially
@keystonejs/keystone
and@keystonejs/adapter-knex
to 7.0.0 and@keystonejs/fields
to 7.0.2.@ejferg Here you go yarn.lock.txt