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

Gatsby: Sentry.captureException() doesn't work unless reinitialized #5727

Closed
3 tasks done
JordanVincent opened this issue Sep 12, 2022 · 7 comments
Closed
3 tasks done
Labels

Comments

@JordanVincent
Copy link

JordanVincent commented Sep 12, 2022

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/gatsby

SDK Version

7.12.1

Framework Version

Gatsby 4.14.1

Link to Sentry event

No response

Steps to Reproduce

Initialize the plugin in gatsby-config.js:

module.exports = {
  plugins: [
    {
      resolve: '@sentry/gatsby',
      options: {
        dsn: 'XXXX',
      },
    },
  ],
}

On the client (e.g. inside a component):

import * as Sentry from '@sentry/gatsby';
Sentry.captureException(new Error('error');

Expected Result

An exception should be sent to Sentry.

Actual Result

Nothing is sent to Sentry (nothing at sentry.io or in the browser's network tab) unless calling Sentry.init({ dns: 'XXXX' }) before calling Sentry.captureException(). Unhandled exceptions are properly captured, but not manual calls to Sentry.captureException().

@JordanVincent JordanVincent changed the title Sentry.captureException doesn't work unless reinitialized Gatsby: Sentry.captureException() doesn't work unless reinitialized Sep 12, 2022
@AbhiPrasad
Copy link
Member

Hey, thanks for writing in! Does this also happen when using a sentry.config.js file as per https://docs.sentry.io/platforms/javascript/guides/gatsby/#sentry-configuration-file?

@AbhiPrasad AbhiPrasad added Status: Needs Information Package: gatsby Issues related to the Sentry Gatsby SDK labels Sep 13, 2022
@JordanVincent
Copy link
Author

Same thing with sentry.config.js. However, I tried downgrading to 6.19.7 and it worked! So version 7 may have introduced a breaking change.

@AbhiPrasad
Copy link
Member

Ah yes we did do this - #4857, but not sure why manual calls are not working.

Will backlog, but PRs are welcome for anyone who would like to help out!

@outsideris
Copy link
Contributor

I can't reproduce it. Can I get detailed configuration files?

@github-actions
Copy link
Contributor

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 1, 2023
@moy2010
Copy link

moy2010 commented Jul 19, 2023

Same thing is happening with Next.js.

@AbhiPrasad
Copy link
Member

@moy2010, please open a GH issue and fill out a new bug report, we'll take a look!

@getsentry getsentry locked as resolved and limited conversation to collaborators Jul 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants