getsentry / sentry-javascript

Official Sentry SDKs for JavaScript
https://sentry.io
MIT License
8.02k stars 1.59k forks source link

'The ReadableStream reader was released' error since 8.33.1 #13931

Open artaommahe opened 1 month ago

artaommahe commented 1 month ago

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/browser

SDK Version

8.33.1

Framework Version

React 18.3.1

Link to Sentry event

https://instruqt.sentry.io/issues/5974845065/?alert_rule_id=4248301&alert_type=issue&environment=production&notification_uuid=2239a562-e5ee-4f80-8733-5f2b64db27a2&project=1218778&referrer=slack

Reproduction Example/SDK Setup

  Sentry.init({
    dsn: '...',
    release: import.meta.env.VITE_REACT_APP_VERSION,
    environment: isDev ? 'development' : 'production',
    allowUrls: ['...'],
    normalizeDepth: 5,
    integrations: [
      Sentry.reactRouterV6BrowserTracingIntegration({
        useEffect,
        useLocation,
        useNavigationType,
        createRoutesFromChildren,
        matchRoutes,
      }),
      Sentry.replayIntegration(),
    ],
    tracesSampleRate: isDev ? 1 : 0.1,
    replaysSessionSampleRate: isDev ? 1 : 0.1,
    replaysOnErrorSampleRate: 1.0,
    beforeBreadcrumb: excludeGraphQLFetch,
    ignoreErrors: [/^ResizeObserver.*/, /^AbortError.*/, 'Object Not Found Matching Id'],
    beforeSend(event) {
      if (event.exception?.values?.some(checkCancellationException)) {
        return null;
      }

      return event;
    },
  });

Steps to Reproduce

Since 8.33.1 update we got new errors in the sentry 'The ReadableStream reader was released' with pointing to the sentry's code

# ../../node_modules/@sentry/utils/build/esm/instrument/fetch.js in resolveResponse at line 157:20

    responseReader.releaseLock();

Looks like the only browser that produces this error for us is Pale Moon 33.4.0

Expected Result

no error from the sentry library

Actual Result

(provided above)

lforst commented 1 month ago

Thanks for reporting this! Super interesting bug. In theory, there is no possible way this could reject since the return values of ReadableStreamDefaultReader.releaseLock() and ReadableStreamBYOBReader.releaseLock() should not return promises. I assume this is specific to the Pale Moon browser.

Since I assume the usage of Pale Moon is rather low, I am a bit hesitant to add edge case handling to the SDK at the cost of bundle size for basically everybody else.

For now, I recommend you add ignoreErrors: ["The ReadableStream reader was released."] to your Sentry.init() which will ignore this error. It should not have any effect on the functionality of your page.

I found that pale moon only recently added support for the ReadableStreams API so maybe they still have to figure some stuff out: https://www.palemoon.org/releasenotes.shtml#:~:text=Added%20an%20initial%20implementation%20of%20the%20ReadableStreams%20API

If more people run into this problem we'll think about adding special casing or a default ignore rule to the SDK.

getsantry[bot] commented 2 days ago

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 remove the label Waiting for: Community, I will leave it alone ... forever!


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