payloadcms / payloadcms/payload

Next.js Server Logs Elide Stacktraces, Making Errors Within PayloadCMS Impossible To Debug

Open
#10,957 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug created-by: Contributor status: needs-triage
Dominant language
TypeScript
Stars
44.8k
Forks
4.2k
Avg merge
2d 21h
Merged PRs (30d)
53

Description

Describe the Bug

When something throws within PayloadCMS itself, a cryptic issue is output to the log:

 ⨯ [TypeError: config.fake is not a function] { digest: '3536476779' }
 GET /admin/create-first-user 500 in 19048ms

This is impossible to debug. Simplest reproducer, set up a template and patch some Payload view with something that throws.

Link to the code that reproduces this issue

https://github.com/stevekuznetsov/payload-logger-reproducer

Reproduction Steps

Start the DB and dev server with:

docker run --name payload --env POSTGRES_PASSWORD=password --env POSTGRES_USER=payload --publish 5432:5432 --detach postgres:17
pnpm dev

Then go to http://localhost:3000/admin/create-first-user to reproduce the issue.

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

area: core

Environment Info
$ pnpm payload info

> my-project@1.0.0 payload /tmp/repro/my-project
> cross-env NODE_OPTIONS=--no-deprecation payload "info"


Binaries:
  Node: 22.11.0
  npm: 10.9.0
  Yarn: 1.22.22
  pnpm: 9.12.2
Relevant Packages:
  payload: 3.20.0
  next: 15.1.6
  @payloadcms/db-postgres: 3.20.0
  @payloadcms/email-nodemailer: 3.20.0
  @payloadcms/graphql: 3.20.0
  @payloadcms/live-preview: 3.20.0
  @payloadcms/live-preview-react: 3.20.0
  @payloadcms/next/utilities: 3.20.0
  @payloadcms/payload-cloud: 3.20.0
  @payloadcms/plugin-form-builder: 3.20.0
  @payloadcms/plugin-nested-docs: 3.20.0
  @payloadcms/plugin-redirects: 3.20.0
  @payloadcms/plugin-search: 3.20.0
  @payloadcms/plugin-seo: 3.20.0
  @payloadcms/richtext-lexical: 3.20.0
  @payloadcms/translations: 3.20.0
  @payloadcms/ui/shared: 3.20.0
  react: 19.0.0
  react-dom: 19.0.0
Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Fri Dec 27 17:05:33 UTC 2024
  Available memory (MB): 64188
  Available CPU cores: 16

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked payload-logger-reproducer, run the documented Docker and pnpm dev commands, and visit /admin/create-first-user to observe the abbreviated error output. Trace the core/Next.js server error-handling path responsible for that log and verify that errors thrown in Payload views expose a usable stacktrace without losing the reported request behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
next.js, node.js, typescript
Domain
backend, observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.