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.

Keystone 6 does not work with next 12

See original GitHub issue

Bug report

Please use this form for bug reports only. If you have a question, feature request or want to chat with us, please select the appropriate option here - https://github.com/keystonejs/keystone/issues/new/choose

Describe the bug

Upgrading to next 12 produces errors

To Reproduce

Steps to reproduce the behaviour. Please provide code snippets or a repository:

  1. create a new keystone app
    yarn create keystone-app
    
  2. add next.js to package
    yarn add next
    
  3. run the server and try to access http://localhost:3000
yarn dev

yarn dev
yarn run v1.22.17
$ keystone-next dev
✨ Starting Keystone
⭐️ Dev Server Starting on http://localhost:3000
⭐️ GraphQL API Starting on http://localhost:3000/api/graphql
✨ Generating GraphQL and Prisma schemas
✨ sqlite database "keystone.db" created at file:./keystone.db
✨ Your database is now in sync with your schema. Done in 693ms
✨ Connecting to the database
✨ Creating server
✅ GraphQL API ready
✨ Generating Admin UI code
✨ Preparing Admin UI app
info  - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
event - compiled successfully

...
event - compiled successfully
event - build page: /next/dist/pages/_error
wait  - compiling...
event - compiled successfully
TypeError: Cannot destructure property 'inAmpMode' of '(0 , _react).useContext(...)' as it is null.
    at Html (webpack-internal:///../../node_modules/@keystone-next/keystone/node_modules/next/dist/pages/_document.js:215:5)
    at processChild (/Users/rainer/git/private/turnen/turnen-ks-empty/node_modules/react-dom/cjs/react-dom-server.node.development.js:3353:14)
    at resolve (/Users/rainer/git/private/turnen/turnen-ks-empty/node_modules/react-dom/cjs/react-dom-server.node.development.js:3270:5)
    at ReactDOMServerRenderer.render (/Users/rainer/git/private/turnen/turnen-ks-empty/node_modules/react-dom/cjs/react-dom-server.node.development.js:3753:22)
    at ReactDOMServerRenderer.read (/Users/rainer/git/private/turnen/turnen-ks-empty/node_modules/react-dom/cjs/react-dom-server.node.development.js:3690:29)
    at Object.renderToStaticMarkup (/Users/rainer/git/private/turnen/turnen-ks-empty/node_modules/react-dom/cjs/react-dom-server.node.development.js:4314:27)
    at Object.renderToHTML (/Users/rainer/git/private/turnen/turnen-ks-empty/node_modules/@keystone-next/keystone/node_modules/next/server/render.tsx:1101:39)
    at doRender (/Users/rainer/git/private/turnen/turnen-ks-empty/node_modules/@keystone-next/keystone/node_modules/next/server/next-server.ts:1669:27)
    at /Users/rainer/git/private/turnen/turnen-ks-empty/node_modules/@keystone-next/keystone/node_modules/next/server/next-server.ts:1783:21
    at /Users/rainer/git/private/turnen/turnen-ks-empty/node_modules/@keystone-next/keystone/node_modules/next/server/response-cache.ts:94:25
TypeError: Cannot destructure property 'inAmpMode' of '(0 , _react).useContext(...)' as it is null.
    at Html (webpack-internal:///../../node_modules/@keystone-next/keystone/node_modules/next/dist/pages/_document.js:215:5)
    at processChild (/Users/rainer/git/private/turnen/turnen-ks-empty/node_modules/react-dom/cjs/react-dom-server.node.development.js:3353:14)
    at resolve (/Users/rainer/git/private/turnen/turnen-ks-empty/node_modules/react-dom/cjs/react-dom-server.node.development.js:3270:5)
    at ReactDOMServerRenderer.render (/Users/rainer/git/private/turnen/turnen-ks-empty/node_modules/react-dom/cjs/react-dom-server.node.development.js:3753:22)
    at ReactDOMServerRenderer.read (/Users/rainer/git/private/turnen/turnen-ks-empty/node_modules/react-dom/cjs/react-dom-server.node.development.js:3690:29)
    at Object.renderToStaticMarkup (/Users/rainer/git/private/turnen/turnen-ks-empty/node_modules/react-dom/cjs/react-dom-server.node.development.js:4314:27)
    at Object.renderToHTML (/Users/rainer/git/private/turnen/turnen-ks-empty/node_modules/@keystone-next/keystone/node_modules/next/server/render.tsx:1101:39)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at doRender (/Users/rainer/git/private/turnen/turnen-ks-empty/node_modules/@keystone-next/keystone/node_modules/next/server/next-server.ts:1669:27)
error Command failed with exit code 1.

Expected behaviour

Server should boot up fine.

System information

  • OS: macOS

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
rburgstcommented, Dec 4, 2021

@mzaien check the associated patch to the docs, the next version MUST match to the next version used in keystone. https://github.com/keystonejs/keystone/pull/7003

0reactions
mzaiencommented, Dec 4, 2021

@mzaien check the associated patch to the docs, the next version MUST match to the next version used in keystone. https://github.com/keystonejs/keystone/pull/7003

Thank you 👍, can this issue be resolved in the future 🧐 we should not force the user from updating until keystone is Updated Edit Can it be at next@latest instead of having a spicifec version of next

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tweets with replies by Keystone JS (@KeystoneJS) / Twitter
We have written a blog post on how it works. https://keystonejs.com/blog/nextjs-keystone… TLDR: You don't need to host Keystone as a separate server and...
Read more >
Error: Cannot find module 'keystone' - Google Groups
Error: Cannot find module 'keystone' ... i run : 1- yo keystone 2- npm install 3- node keystone and i got this ......
Read more >
FAQs About Online Learning Programs | The Keystone School
Can students work at an accelerated pace and move on to the next grade?
Read more >
Newest 'keystone' Questions - Stack Overflow
Keystone js 6 does not allow me to add checkbox field, that looks the following way ... Next run dev compiled successfully, but...
Read more >
keystone-6-oauth-next - npm Package Health Analysis - Snyk
In the past month we didn't find any pull request activity or change in issues status has been detected for the GitHub repository....
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