Payload 2.0 local API in monorepo with Next #3649
Closed
r1tsuu
started this conversation in
Feature Requests & Ideas
Replies: 1 comment
-
Hello, i actually resolved an issue with middleware Next in custom-server and 2.0 works!, i will create an issue |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
First of all, thanks for the new version of Payload.
We are using monorepo setup with Next.js and Payload for Local API usage (not custom server because Next middleware doesn't work with it and seems like there's no way to solve it, which is used by next-intl library).
It works great with Payload 1.15.8 and this gives us powerful DX (auto-ts for operations), we are also using in our app actively Next server actions and inside them call local API,
I would like to use 2.0, but unfortunately i can't make it work with this.
Repo with sample: (copy .env.example in both cms and web)
https://github.com/r1tsuu/payload2.0-next-monorepo-issue
There are several issues that i noticed:

'use client' Next.js error when importing Payload - this i managed to solve with adding 'use client' to these files:
node_modules/.pnpm/@payloadcms[email protected][email protected]/node_modules/@payloadcms/richtext-slate/dist/field/index.js
node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/payload/dist/admin/components/forms/field-types/index.js
With this way i avoided 'use client' Next error, but got another one:
There's no package called "private-next-rsc-mod-ref-proxy" on npm, by name seems like it's a Next's thing that adds something like context to client module.
I don't know should it be issue or not, so i created discussion
Beta Was this translation helpful? Give feedback.
All reactions