Skip to content

ValidationError becomes o after Next.js build #13645

@nathanbowang

Description

@nathanbowang

Describe the Bug

When using Payload CMS with Next.js, the error name changes after build:

  • In next dev: "name": "ValidationError"
  • In next start: "name": "o"

This happens because Next.js minifies class names in production.

Solution

Disable server-side minification in next.config.js:

/** @type {import('next').NextConfig} */
const nextConfig = {
  distDir: 'dist',
  experimental: {
    serverMinification: false,
  },
}

vercel/next.js#59594

Link to the code that reproduces this issue

https://github.com/payloadcms/payload/blob/main/.github/reproduction-guide.md

Reproduction Steps

next build

Which area(s) are affected? (Select all that apply)

area: core

Environment Info

"@payloadcms/db-postgres": "^3.50.0",
"@payloadcms/next": "^3.50.0",
"@payloadcms/ui": "^3.50.0",
"next": "15.1.5",
"payload": "^3.50.0",

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions