Skip to content

There are some types of exceptions that can't be caught by @sentry/nextjs #3543

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

Closed
4 of 9 tasks
redshoga opened this issue May 14, 2021 · 5 comments
Closed
4 of 9 tasks
Assignees
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK

Comments

@redshoga
Copy link

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other:@sentry/nextjs

Version:

"@sentry/nextjs": "^6.3.6",
"next": "^10.0.8",

Description

Exceptions that do not jump to an error page, such as the following, can be correctly detected by Sentry.

import React from 'react';

const Sample: React.FC = () => {
  return (
    <button
      onClick={() => {
        throw new Error('Sentry Frontend Error! in useEffect');
      }}
    >
      Throw error
    </button>
  );
};

export default Sample;

However, Sentry will not detect exceptions that redirect to error pages, such as the following, if you only set @sentry/nextjs.

import React, { useEffect } from 'react';

const Sample: React.FC = () => {
  useEffect(() => {
    throw new Error('Sentry Frontend Error! in useEffect');
  }, []);

  return (
    <button
      onClick={() => {
        // throw new Error('Sentry Frontend Error! in useEffect');
      }}
    >
      Throw error
    </button>
  );
};

export default Sample;

Does the developer need to include code on the _error page to notify Sentry, as in the following sample?

https://github.com/vercel/next.js/blob/canary/examples/with-sentry/pages/_error.js

@myyellowshoe
Copy link

Noticing the same issue here.

@NoobTW
Copy link

NoobTW commented Jun 23, 2021

Same here.

  • @sentry/nextjs: ^6.7.2
  • next: ^10.2.3

Adding custom _error.js is a workaround for me.

@iker-barriocanal iker-barriocanal added Package: nextjs Issues related to the Sentry Nextjs SDK Status: Backlog and removed Status: Untriaged labels Sep 27, 2021
@iker-barriocanal
Copy link
Contributor

Related to #3869, #3901, #3970 and #3970.

@timfish
Copy link
Collaborator

timfish commented Dec 4, 2022

This issue is over a year old.

Is this still reproducible in the latest version of the SDK? If so, does this answer how to overcome this?

@smeubank
Copy link
Member

closing issue for now, since there are a number of at least seemingly related issue we have in the backlog as well. We can re-open if needed

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
Projects
None yet
Development

No branches or pull requests

8 participants