supertokens / supertokens-website

Frontend SDK for SuperTokens - for session management + automatically refreshing sessions
https://supertokens.com
Other
54 stars 13 forks source link

Fetch interceptor causing error in development when using an ad blocker #220

Open meandillar opened 1 year ago

meandillar commented 1 year ago

When a google ad pixel fires we get the error Uncaught (in promise) TypeError: Failed to fetch if using Adblock Plus extension. I'm using Chrome on mac.

The ad pixel request looks something like this:

    fetch("https://some-google-ad-url.com/some-url-slug", {
        browsingTopics: true,
        keepalive: true
    })

The error occurs in recipeImplementation.js here:

Screenshot 2023-05-26 at 8 14 58 AM

I can disable the ad blocker and the problem disappears but this error doesn't occur when not using supertokens so I thought I should report the bug.

EDIT: happens both in development and production

rishabhpoddar commented 1 year ago

Thanks for raising this issue. We will have a look.

porcellus commented 1 year ago

I've started investigating this problem, and I have a few questions:

meandillar commented 1 year ago

@porcellus sorry for taking a while to reply.

In development, rather than just a "failed to fetch" error we also get an error popup (we're using nextjs) like this:

Screenshot 2023-07-04 at 2 09 33 PM

The error that is causing problems still gets logged to the console without supertokens but is smaller and doesn't trigger the nextjs error popup. Here are screenshots with and without supertokens initialised:

Screenshot 2023-07-04 at 2 10 15 PM Screenshot 2023-07-04 at 2 11 34 PM

Hope that helps :)