question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Next.js SDK not injected in dev mode

See original GitHub issue

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/nextjs

SDK Version

7.21.0

Framework Version

Next.js v12.3.0

Link to Sentry event

No response

Steps to Reproduce

In a sentry.server.config.js, use the beforeSend:

Sentry.init({
   ...
    beforeSend(event) {
        console.log("SENTRY EVENT");
        return event;
    },
});

Expected Result

The console log of “SENTRY EVENT” doesn’t show up in the terminal. Using the same method in a sentry.client.config.js does, however, trigger the console log in the browser’s console.

Actual Result

I’m uncertain if this is intended or neglected. It seems that the client and server use different config SDK’s. I was only able to find the type definition of beforeSend in the client config, not server config.

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:23 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
lforstcommented, Nov 29, 2022

Ok we just released 7.22.0 can you check whether it resolves this issue?

1reaction
lforstcommented, Nov 29, 2022

Should I go through the whole event object and check for any key that may have a SSN string in it (ssn, socialNumber, socialSecurityNumber, …) + check in each key→value for any SSN formats (XXXXXXXXXX, XXX-XXX-XXX, …)?

Yeah there’s no clear cut way where to look for it. It all depends on how you set up the SDK. PII might be everywhere - breadcrumbs, in the error messages, even in stack traces sometimes. We recommend being careful when handling data like that.

Alright - looking forward. I’d imagine that it will be released as a patch version?

We’ll probably release it as a minor.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Basic Features: Handling Scripts - Next.js
The Script component solves these problems by providing a declarative API for loading third-party scripts. It provides a set of built-in loading strategies ......
Read more >
sentry/nextjs not working on server · Issue #3691 - GitHub
My app does indeed start, and everything looks normal. One thing to note: in dev mode, when NODE_ENV !== 'production' , i do...
Read more >
nextjs - use _error.js in dev mode - Stack Overflow
When I build with as a production env, no problem, my custom error page is picked up. Any idea on how to render...
Read more >
Walkthrough: Connecting the Next.js application directly to the ...
Set up your local front-end development on operating systems that don't support Windows containers.
Read more >
Manual Setup for Next.js - Sentry Documentation
Learn how to set up the SDK manually.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found