Skip to content

auth.setSession returns AuthRetryableFetchError #1292

Closed
@RostislavGG

Description

@RostislavGG

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

In my react-native expo app I'm using email sign-up with confirmation and a password reset workflow. I'm creating a session from the confirmation URL sent on sign up the following way.

createSessionFromUrl = async (url) => {
        const { params, errorCode } = QueryParams.getQueryParams(url);
        if (errorCode) throw new Error(errorCode);
        const { access_token, refresh_token } = params;
        if (!access_token) return;

        const { data, error } = await supabase.auth.setSession({
            access_token,
            refresh_token,
        });

        if (error) throw error;
    };

In Expo Go everything works fine. The issue comes when I build my app and test it on my device through TestFlight. Upon receiving and going through the confirmation link to the app, receiving the URL and eventually ending up in the mentioned function supabase.auth.setSession returns an error AuthRetryableFetchError with a status: 0. Apart from happening only on production, the other annoying part is that it's not consistent. Every second or third attempt will fail even tho the URL and the tokens are valid.

It's important to note that receiving a link for password reset goes through the same workflow and always succeeds without issues.

To Reproduce

Because of the nature of the issue I can't give any concrete steps. But any suggestion would be welcome.

Expected behavior

setSession, given valid access_token and refresh_token should always succeed

System information

  • OS: iOS
  • Version of supabase-js: "@supabase/supabase-js": "^2.45.6"
  • Expo version: "expo": "^51.0.37"
  • React Native: "react-native": "0.74.5"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions