Intermittent network failures on self-hosted instance cause token renewal failure and session logout
https://sonarly.com/issue/13837?type=bug Intermittent `TypeError: Failed to fetch` errors on POST to `https://vedio.twenty.com/metadata` cause the token renewal flow to fail, logging the user out and redirecting to `/welcome`.
This commit is contained in:
+13
-1
@@ -27,10 +27,22 @@ export const PromiseRejectionEffect = () => {
|
||||
error.networkError?.name === 'AbortError' ||
|
||||
error.name === 'AbortError';
|
||||
|
||||
if (!isAbortError) {
|
||||
// Transient network errors (Failed to fetch, Load failed) from Apollo
|
||||
// are not actionable — typically caused by unstable connectivity or
|
||||
// browser tab backgrounding. Skip both the snackbar and Sentry.
|
||||
const isTransientNetworkError =
|
||||
error.name === 'ApolloError' &&
|
||||
isEmpty(error.graphQLErrors) &&
|
||||
error.networkError?.name === 'TypeError';
|
||||
|
||||
if (!isAbortError && !isTransientNetworkError) {
|
||||
enqueueErrorSnackBar({});
|
||||
}
|
||||
|
||||
if (isTransientNetworkError) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const { captureException } = await import('@sentry/react');
|
||||
captureException(error, (scope) => {
|
||||
|
||||
@@ -54,6 +54,14 @@ export const SentryInitEffect = () => {
|
||||
tracesSampleRate: 1.0,
|
||||
replaysSessionSampleRate: 0.1,
|
||||
replaysOnErrorSampleRate: 1.0,
|
||||
ignoreErrors: [
|
||||
// Transient network errors from Apollo — not actionable,
|
||||
// typically caused by unstable connectivity on self-hosted
|
||||
// instances or browser tab backgrounding.
|
||||
'Failed to fetch',
|
||||
'NetworkError when attempting to fetch resource',
|
||||
'Load failed',
|
||||
],
|
||||
});
|
||||
|
||||
setIsSentryInitialized(true);
|
||||
|
||||
Reference in New Issue
Block a user