Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next 13.4 breaks keystone #8575

Closed
pc-erin opened this issue May 12, 2023 · 6 comments
Closed

Next 13.4 breaks keystone #8575

pc-erin opened this issue May 12, 2023 · 6 comments

Comments

@pc-erin
Copy link

pc-erin commented May 12, 2023

Run npm i && npm update
Run npm run dev

The admin panel and console will show the following error:
TypeError: Cannot read properties of null (reading 'useContext')

If you run npm ls next you'll see that the version of next installed appears to be 13.4 instead of the 13.3 specified in the keystone dependencies.

It seems like next 13.4 causes some kind of problem for keystone.

My workaround so far is to add

"overrides": {
		"@keystone-6/core": {
			"next": "13.3.0"
		},
		"@keystone-6/auth": {
			"@keystone-6/core": {
				"next": "13.3.0"
			}
		},
		"@keystone-6/field-document": {
			"@keystone-6/core": {
				"next": "13.3.0"
			}
		}
	},

to my package.json file to lock the version of next to 13.3.0.

I'd suggest using exact versions in keystone's dependencies to prevent this sort of thing in the future.

@LunaTK
Copy link

LunaTK commented May 13, 2023

a single resolution field in package.json would fix this as well.

{
  "name": "my-app",
  "version": "1.0.2",
  "private": true,
  "scripts": {
    "dev": "keystone dev",
    "start": "keystone start",
    "build": "keystone build",
    "postinstall": "keystone build --no-ui --frozen"
  },
  "dependencies": {
    "@keystone-6/auth": "^7.0.0",
    "@keystone-6/core": "^5.0.0",
    "@keystone-6/fields-document": "^7.0.0",
    "typescript": "^4.9.5"
  },
  "resolutions": {
    "next": "~13.3.0"
  }
}

after running yarn install again, nextjs will be downgraded to 13.x

@dcousens
Copy link
Member

Duplicate of #8553, but I'll leave this issue open until the newest version of Keystone is published.

@dcousens
Copy link
Member

I'd suggest using exact versions in keystone's dependencies to prevent this sort of thing in the future.

We will probably need to do this to be honest, but if we change it now, that may be a breaking change for some users.

@ciruz
Copy link
Contributor

ciruz commented May 15, 2023

Damn I was thinking I did something wrong. @dcousens the thing is, if you setup keystone from the scratch, with the quick-start guide, it's broken as well: https://keystonejs.com/docs/getting-started#quick-start

So it's not only the update.

image

image

image

@Durwinner
Copy link

Keystone requires a higher version of Next.js, specifically version 13.3 or above. If you encounter an error, please make sure to use at least this version. To fix the issue, you can add the following code to your package.json file:

"resolutions": {
  "next": "~13.3.0"
}

By adding this code, you're specifying a resolution to use Next.js version 13.3.0 or a compatible version. This can help resolve the problem you're facing. Make sure to save the package.json file after making this change.

@MohammadKurjieh
Copy link
Contributor

This was resolved in #8568 please try using the latest version of keystone

@dcousens dcousens closed this as completed Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants