Keystone: Starter Project w/Knex Adapter Failing on Startup

Created on 25 Mar 2020  ยท  6Comments  ยท  Source: keystonejs/keystone

Bug report

Describe the bug

I followed the quick start guide. I wanted to create the "Starter (Users + Authentication)" type of app with the PostgreSQL database. Below is an output from my terminal of what I did (PLEASE NOTE: I had already created the database on a previous try that ended in the exact same error).

To Reproduce

๏…น ๏ผ ~/Projects โฏ yarn create keystone-app school-dispatch                                                                                                                                      ๏‰’ 4s
yarn create v1.22.4
[1/4] ๐Ÿ”  Resolving packages...
[2/4] ๐Ÿšš  Fetching packages...
[3/4] ๐Ÿ”—  Linking dependencies...
[4/4] ๐Ÿ”จ  Building fresh packages...
success Installed "[email protected]" with binaries:
      - create-keystone-app
[############################################################] 60/60

 โ•ฆโ•”โ• โ•”โ•โ•— โ•ฆ โ•ฆ โ•”โ•โ•— โ•”โ•ฆโ•— โ•”โ•โ•— โ•”โ•—โ•” โ•”โ•โ•—  โ•ฆ โ•”โ•โ•—
 โ• โ•ฉโ•— โ•‘โ•ฃ  โ•šโ•ฆโ• โ•šโ•โ•—  โ•‘  โ•‘ โ•‘ โ•‘โ•‘โ•‘ โ•‘โ•ฃ   โ•‘ โ•šโ•โ•—
 โ•ฉ โ•ฉ โ•šโ•โ•  โ•ฉ  โ•šโ•โ•  โ•ฉ  โ•šโ•โ• โ•โ•šโ• โ•šโ•โ• โ•šโ• โ•šโ•โ•


Answer a few questions and we'll generate a starter project for you.

โœ” What is your project name? โ€ฆ School Dispatch
โœ” Select a starter project โ€บ Starter (Users + Authentication)
โœ” Select an adapter โ€บ Knex
โœ” Copying project files
Installing dependencies with yarn. This could take a few minutes.
โœ” Installed dependencies

  ๐ŸŽ‰  KeystoneJS created a starter project in: school-dispatch

  To launch your app, run:

  - cd school-dispatch
  - yarn dev

  Next steps:

  - View your app
  - Edit school-dispatch/index.js to customize your app.
  - Open the Admin UI
  - Read the docs
  - Star KeystoneJS on GitHub

โœจ  Done in 48.18s.
๏…น ๏ผ ~/Projects โฏ cd school-dispatch                                                                                                                                                           ๏‰’ 48s
๏…น ๏ผ ~/Projects/school-dispatch โฏ yarn dev
yarn run v1.22.4
$ cross-env NODE_ENV=development DISABLE_LOGGING=true keystone dev
โ„น Command: keystone dev
โœ” Validated project entry file ./index.js
โœ” Keystone server listening on port 3000
โœ” Initialised Keystone instance
โœ– Connecting to database
{ Error: Cannot read property 'find' of undefined
    at Promise.all.then.results (/Users/caleb/Projects/school-dispatch/node_modules/@keystonejs/utils/dist/utils.cjs.dev.js:48:21)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  errors:
   { KnexAdapter:
      TypeError: Cannot read property 'find' of undefined
          at fieldAdapters.forEach.fieldAdapter (/Users/caleb/Projects/school-dispatch/node_modules/@keystonejs/adapter-knex/lib/adapter-knex.js:258:31)
          at Array.forEach (<anonymous>)
          at KnexListAdapter._postConnect (/Users/caleb/Projects/school-dispatch/node_modules/@keystonejs/adapter-knex/lib/adapter-knex.js:257:24)
          at Object.values.forEach.listAdapter (/Users/caleb/Projects/school-dispatch/node_modules/@keystonejs/adapter-knex/lib/adapter-knex.js:73:19)
          at Array.forEach (<anonymous>)
          at KnexAdapter.postConnect (/Users/caleb/Projects/school-dispatch/node_modules/@keystonejs/adapter-knex/lib/adapter-knex.js:72:38)
          at KnexAdapter.connect (/Users/caleb/Projects/school-dispatch/node_modules/@keystonejs/adapter-knex/node_modules/@keystonejs/keystone/lib/adapters/index.js:29:38)
          at process._tickCallback (internal/process/next_tick.js:68:7) } }
error Command failed with exit code 1.

Expected behaviour

I expected to be able to start up my demo project.

System information

  • OS: macOS (10.14.6)

Most helpful comment

Hey @wcalebgray
Had the same issue. It looks like a problem with version mismatch between @keystonejs/keystone and @keystonejs/adapter-knex
I noticed that I had those in package.json:
"@keystonejs/adapter-knex": "^7.0.0",
"@keystonejs/keystone": "^6.0.1",
after upgrade to:
"@keystonejs/adapter-knex": "^7.0.0",
"@keystonejs/keystone": "^7.0.0",
keystone started working

All 6 comments

I also already have tried the {dropDatabase: true hack that I saw in other solutions, but that didn't work here.

Hey @wcalebgray
Had the same issue. It looks like a problem with version mismatch between @keystonejs/keystone and @keystonejs/adapter-knex
I noticed that I had those in package.json:
"@keystonejs/adapter-knex": "^7.0.0",
"@keystonejs/keystone": "^6.0.1",
after upgrade to:
"@keystonejs/adapter-knex": "^7.0.0",
"@keystonejs/keystone": "^7.0.0",
keystone started working

Can confirm the update to keystone fixed. Thanks @wini16

Just ran into this when looking into the project as a possible option, glad someone shared this with me.

Confirmed as well, thanks @wini16 ! Leaving this open until either myself or someone can fix the starter app stuff.

This has been fixed in version 3.0.0 of create-keystone-app. Please try running the script at this new version and by all means re-open this ticket if you find the same/similar issues with the latest version.

Was this page helpful?
0 / 5 - 0 ratings