Open Dhrumil-Sentry opened 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?
We have solved this issue with manually setting custom fingerprints
. Ticket can be closed.
@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
I am running into this issue as well. All AxiosError status codes are combined into a single Sentry issue.
Routing to @getsentry/product-owners-issues for triage ⏲️
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