payload icon indicating copy to clipboard operation
payload copied to clipboard

server-only causes errors when generating types, migrations, or sourceMaps

Open HarleySalas opened this issue 6 months ago • 3 comments

Link to reproduction

https://github.com/HarleySalas/payload-3-reproductions/tree/server-only-error

Payload Version

beta.91

Node Version

22.2.0

Next.js Version

canary-104

Describe the Bug

server-only is a best practice for ensuring code is only run on the server.

This issue was previously resolved in #6383, however it has resurfaced, I assume in beta.79.

Reproduction Steps

Use a function with import 'server-only' inside of the payload config somewhere(?) In my case, its for a custom auth strategy, but I'd assume its causing errors anywhere that it'd be used.

Then, try payload generate:types, payload migrate:create, etc.

Adapters and Plugins

n/a

HarleySalas avatar Aug 25 '24 10:08 HarleySalas