Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In Next.js-project, errors inside pages/api not caught by Sentry when deployed on Vercel #11708

Closed
3 tasks done
Danane84 opened this issue Apr 21, 2024 · 3 comments · Fixed by #12133
Closed
3 tasks done
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK Type: Bug

Comments

@Danane84
Copy link

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

7.111.0

Framework Version

Next.jsj 13.5.6

Link to Sentry event

No response

SDK Setup

Sentry.init({
dsn: SENTRY_DSN,

// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1,

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
});

Steps to Reproduce

Create a Next.js app, add Sentry, deploy on Vercel

Expected Result

Errors from the pages/api folder are reported in Sentry, when deployed on Vercel

Actual Result

Errors from the pages/api folder are not reported in Sentry, when deployed on Vercel

@github-actions github-actions bot added the Package: nextjs Issues related to the Sentry Nextjs SDK label Apr 21, 2024
@s1gr1d
Copy link
Member

s1gr1d commented Apr 22, 2024

Hello, thanks for reaching out! Did you use the wizard for setting up Sentry or did you set it up manually?

Where did you set up init? If you haven't already, you need to set up the init function in sentry.server.(js|ts) to make it work on the server-side.

@Danane84
Copy link
Author

Hi Sigrid, thanks for your quick reply!

I set up Sentry by using the wizard. My init is located in sentry.server.config.js inside the root-directory of my project and looks as follows:

import * as Sentry from "@sentry/nextjs";
import { SENTRY_DSN } from "./config";

Sentry.init({
  dsn: SENTRY_DSN,

  tracesSampleRate: 1,

  debug: false,
});

Liebe Grüße von Wien nach Wien ;)

@s1gr1d
Copy link
Member

s1gr1d commented Apr 22, 2024

Servus!

This setup seems correct so far. Some additional things you could check:

  • Is the SENTRY_DSN variable defined?
  • Can you post the debug logs? (after setting debug: true)
  • Are you using Vercel Edge?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK Type: Bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants