getsentry / sentry

Developer-first error tracking and performance monitoring
https://sentry.io
Other
39.31k stars 4.22k forks source link

Issues with different status codes get incorrectly grouped into a single issue #71630

Open Dhrumil-Sentry opened 6 months ago

Dhrumil-Sentry commented 6 months ago

Environment

SaaS (https://sentry.io/)

Steps to Reproduce

A NextJS customer complained on Discord about Overgrouping

They don't have source maps, the error message has a very slight difference due to different status codes in each error message.

Expected Result

The user expects a different issue for 400s, 409s, 504s

Actual Result

Errors of all types of status codes get grouped into a single issue incorrectly

Product Area

Issues

Link

No response

DSN

No response

Version

No response

felixhagspiel commented 6 months ago

to add a bit more context, we are logging errors from axios like this:

axios({
      url: process.env.NEXT_PUBLIC_API_SERVER_URL! + url,
      ...options,
      headers: {
        Authorization: `Bearer ${token}`,
        ...options?.headers,
        'Accept-Language': locale,
      },
    })
      .then((resp) => ({
        error: false,
        data: resp.data as T,
        status: resp.status,
      }))
      .catch((err) => {
        logApiError(err); // here we call logApiError()
        return {
          data: undefined,
          error: err?.response?.data || true,
          status: err?.response?.status,
        };
      });

export const logApiError = (error: any): void => {
  try {
    if (error?.response?.status !== 401) {
      Sentry.captureException(error, {
        extra: {
          // ...
        },
      });
      console.error(`API Error `, error);
    }
  } catch (e) {
    console.error(`Error reporting to Sentry! `, error);
  }
};

Would it make a difference to not catch the error-promise, but wrap the axios call in a try/catch and send the exception to sentry rather than using the error returned from axios?

felixhagspiel commented 6 months ago

We have solved this issue with manually setting custom fingerprints. Ticket can be closed.

Dhrumil-Sentry commented 6 months ago

@felixhagspiel thanks for your feedback, we're keeping this ticket open because we've heard this feedback from other users too and we'd like to figure out a product solution for this case

rachel-fh commented 2 weeks ago

I am running into this issue as well. All AxiosError status codes are combined into a single Sentry issue.

getsantry[bot] commented 2 weeks ago

Routing to @getsentry/product-owners-issues for triage ⏲️