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 boot in existing project: "TypeError: Cannot read property 'prepare' of undefined"

See original GitHub issue

This is a two-part issue. The first was when – in an almost two month old project – I attempted to add some additional relationships, writing the additional Lists and putting the correct Relationship fields into one of my Lists. At that point that List into which I added the new relationships could not see any of the relationships it had – neither the new ones, nor the old ones, even after I edited the file and removed all new code. I had to download from the repo to solve the problem.

I tried it again with the newly downloaded repo, step by step, just adding one file to the project. At the point it blew up again – an existing relationship_ no longer worked, even though I hadn’t added any new ones, just added one file.

I deleted the new file and attempted to boot and now I am getting

✔ Initialised Keystone instance
✖ Connecting to database
TypeError: Cannot read property 'prepare' of undefined
    at executeDefaultServer (/Users/ranthony/Documents/projects/yaa-cms2/node_modules/@keystonejs/keystone/bin/utils.js:112:42)
error Command failed with exit code 1.

Even though I’ve correctly initialised the Keystone instance. It booted fine until I added a new file to the project. I dropped the Mongo DB, just to see if that helped, but it did not.

Any idea what the above error might indicate?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
wesboscommented, Oct 23, 2020

Got this too, make sure you export keystone from your index.js:

module.exports.keystone = keystone;

0reactions
Nikodermuscommented, Jan 16, 2021

Just got that one, also, if you are using ESM

export const keystone = new Keystone({ ... })
export default { keystone, apps: [ ... ]}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >
"Cannot read property 'match' of undefined" during Npm install
Where typescript in one of my project fail internally with cannot read property "" of undefined ! Rolling back to v3.9 run successfully!...
Read more >
ERROR TypeError: Cannot read property title of undefined
HEY, SET YOUR LIKE THERE ! ... Your browser can't play this video. ... Solved: ERROR TypeError : Cannot read property title of...
Read more >
Cannot read properties of undefined' - JavaScript Debugging
How To Fix 'Uncaught TypeError : Cannot read properties of undefined ' - JavaScript Debugging.
Read more >
"Cannot read properties of null" error when attempting to ...
An application error occured. Refresh your browser or close it and sign in again. Cannot read properties of null (reading 'toLowerCase').
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