Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

[3.0 Beta] Using Next.js version 14.2.1 results in an error #113

Closed
todor0v opened this issue Apr 15, 2024 · 9 comments
Closed

[3.0 Beta] Using Next.js version 14.2.1 results in an error #113

todor0v opened this issue Apr 15, 2024 · 9 comments
Assignees

Comments

@todor0v
Copy link

todor0v commented Apr 15, 2024

Link to reproduction

No response

Describe the Bug

When trying to log in after installing Payload using npx create-payload-app@beta on an existing project with Next.js version 14.2.1 I get the following error:

createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/context-in-server-component

Then I get a GET /api/users/me returning 500.

The error is not present if I use Next.js 14.2.0-canary.23 like the 3.0 Demo.

To Reproduce

Install Payload on an existing project using Next.js 14.2.1 and try to login or register a user.

Payload Version

3.0.0-beta.10

Adapters and Plugins

db-mongodb, next, richtext-lexical

@jmikrut
Copy link
Member

jmikrut commented Apr 15, 2024

Tracked on Next.js repo already here:

vercel/next.js#64412

This is only using Turbopack, right?

@jmikrut jmikrut transferred this issue from payloadcms/payload Apr 15, 2024
@todor0v
Copy link
Author

todor0v commented Apr 15, 2024

@jmikrut That is correct. The issue is only present if I use next dev --turbo.

@jmikrut jmikrut self-assigned this Apr 15, 2024
@jmikrut
Copy link
Member

jmikrut commented Apr 16, 2024

Hey @todor0v — looks like they fixed the issue, but the fix has not yet been released as a canary. I'll keep this open until we see confirmation that the fix works in a released Next.js canary.

@todor0v
Copy link
Author

todor0v commented Apr 16, 2024

@jmikrut Thank you so much! 🙏

@KnotScientific
Copy link

@jmikrut @todor0v was this fixed in 14.3.0-canary.8 or 14.3.0-canary.7? I see the fix as part of the commits, but after installing 14.3.0-canary.8 and running next dev --turbo. I'm still running into the same issue.
Screenshot 2024-04-17 at 6 03 03 PM

@luochuanyuewu
Copy link

@jmikrut @todor0v was this fixed in 14.3.0-canary.8 or 14.3.0-canary.7? I see the fix as part of the commits, but after installing 14.3.0-canary.8 and running next dev --turbo. I'm still running into the same issue. Screenshot 2024-04-17 at 6 03 03 PM

Me on the same page.

@todor0v
Copy link
Author

todor0v commented Apr 19, 2024

@luochuanyuewu @KnotScientific As far as I can see not yet. I still get the same error using Payload 3.0.0-beta.10 (or 11) and Next.js 14.3.0-canary-11

@paulpopus
Copy link
Contributor

We've updated the original issue in Nextjs vercel/next.js#64412 regarding this, it looks like turbo is still not fully functioning with client side components

@jmikrut
Copy link
Member

jmikrut commented Apr 27, 2024

Happy to report that this is now fixed!

@jmikrut jmikrut closed this as completed Apr 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants