Skip to content

@clerk/nextjs logs are truncated on netlify #1683

Description

@mcky
  • I have reviewed the documentation
  • I have searched for existing issues
  • I have ensured I am on the most recent version, and checked the changelog for that version
  • I have provided the Frontend API key from my application dashboard: pk_test_Y2hlZXJmdWwtbWFtbW90aC00OC5jbGVyay5hY2NvdW50cy5kZXYk
  • I have provided a minimal reproduction or replay recording below

Brief Summary of the Issue

I'm unable to view the full output of the debug logs on netlify as netlify seems to cap the length of it. This is because the package emits all logs on one line instead of one per debug statement.

It would be great if this decision was either reconsidered, or a logger instance of our own could be passed in to workaround this problem. It seems to be a problem in vercel environments too considering the truncate function.

Minimal Reproduction or Replay

We require either a minimal reproduction or a replay recording to be able to address a bug report. Any issues lacking a minimal reproduction or replay recording will be closed.

This line in the debug logger causes all log lines to be emitted in one console.log

I appreciate that netlify's handling is out of your control, but the decision to combine all logs into one call has made for an extremely frustrating debugging experience

A repro/recording here really wouldn't tell you anything more than the ticket/screenshot

See the logs here are truncated before the headers have even finished printing (this is datadog, but it's the same in the netlify log streaming UI)
CleanShot 2023-09-05 at 16 55 13

Patching the package (using pnpm patch @clerk/nextjs@4.23.0) and to make each .debug() call trigger a console.log immediately allows me to inspect all logs, and finally see the auth state log section
CleanShot 2023-09-05 at 19 29 46

Browser/OS

N/A

Package + Version

  • @clerk/nextjs 4.23.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions