Skip to content

Backend logs not sending on Next.JS + Vercel/Prod build (FRESH create-next-app + sentry-wizard reproduction) #17604

@jonoc330

Description

@jonoc330

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nextjs

SDK Version

10.11.0

Framework Version

Next v15.5.3

Link to Sentry event

No response

Reproduction Example/SDK Setup

https://github.com/buildpass-au/sentry-test

Steps to Reproduce

  1. npx create-next-app@latest sentry-test
    ✔ Would you like to use TypeScript? … Yes
    ✔ Which linter would you like to use? › ESLint
    ✔ Would you like to use Tailwind CSS? … Yes
    ✔ Would you like your code inside a src/ directory? … No
    ✔ Would you like to use App Router? (recommended) … Yes
    ✔ Would you like to use Turbopack? (recommended) … Yes
    ✔ Would you like to customize the import alias (@/* by default)? … Yes
    ✔ What import alias would you like configured? … @/*

  2. npx @sentry/wizard@latest -i nextjs --saas --org buildpass --project sentry-test
    ◇ Selected project sentry-test
    ◇ Installed @sentry/nextjs with NPM.
    ◇ Do you want to route Sentry requests in the browser through your Next.js server to avoid ad blockers?
    │ No
    ● Sounds good! We'll leave the option commented for later, just in case :)
    ◇ Do you want to enable Tracing to track the performance of your application?
    │ Yes
    ◇ Do you want to enable Session Replay to get a video-like reproduction of errors during a user session?
    │ No
    ◇ Do you want to enable Logs to send your application logs to Sentry?
    │ Yes
    ◆ Created fresh sentry.server.config.ts.
    ◆ Created fresh sentry.edge.config.ts.
    ◆ Added new instrumentation.ts file.
    ◆ Added new instrumentation-client.ts file.
    ◆ Added Sentry configuration to next.config.ts. (you probably want to clean this up a bit!)
    ◆ Created app/global-error.tsx.
    ◇ Do you want to create an example page ("/sentry-example-page") to test your Sentry setup?
    │ Yes
    ◆ Created app/sentry-example-page/page.tsx.
    ◆ Created app/api/sentry-example-api/route.ts.
    ◆ Created .env.sentry-build-plugin with auth token for you to test source map uploading locally.
    ◆ Added .env.sentry-build-plugin to .gitignore.

  3. Use bun install
    [0.12ms] ".env"
    bun install v1.1.30 (7996d06b)
    [3.66ms] migrated lockfile from package-lock.json

16 packages installed [304.00ms]

  1. Add consoleLoggingIntegration to all 3 Sentry.init files
integrations: [
    Sentry.consoleLoggingIntegration(),
],
  1. Change disableLogger to false in next.config.ts

  2. Add a console.log to both sentry-example-api and sentry-example-page

  3. Run bun dev, test both api and frontend routes. Logs will work for both frontend and backend in local dev. I noticed that I wasn't getting any exceptions logged for the api route. I only got the frontend error.

  4. Run bun run build and then bun run start.

  5. Test the same routes. No logging ends up in Sentry, including front end logs.

  6. Deploy to Vercel.
    Front end logs work, backend logs do not.

Expected Result

There SHOULD be backend logs when you run a Next.JS server in production mode.

Actual Result

No backend logs at all on both local production build + deployed Vercel build.

Additional Context

Vercel test after hitting https://sentry-test.preview.buildpass.com.au/sentry-example-page and https://sentry-test.preview.buildpass.com.au/api/sentry-example-api

Image Image

Metadata

Metadata

Assignees

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions