-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add retries to Supabase client #382
Conversation
✅ Deploy Preview for n3-supabase canceled.
|
Hi, just wanted to bump this again, would be super cool to have this at some point :) thank you for your help! |
c019b24
to
e9441db
Compare
After a discussion with the Supabase Auth team, it seems @supabase/[email protected] might fix some websocket auth issues
From what I see the main issue is that |
I tried it a few months ago and gave the supabase client first If I remember correctly, the problem was that just |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @felixgabler, sorry for the delay, I'm back from holdidays and want to merge all pending PRs.
I've just let a comment about the realtime.setAuth
method that you're using. I don't understand the relation with the retry fetch.
Concerning this PR, it LGTM since using ofetch
does not seem possible in this case. We can keep the retry as the default pattern and if people want be able to configure/remove it, they can create a PR.
Are you using this retry version on your project currently?
@@ -26,6 +31,7 @@ export default defineNuxtPlugin({ | |||
|
|||
// Updates the session and user states through auth events | |||
client.auth.onAuthStateChange((_, session: Session | null) => { | |||
client.realtime.setAuth(session?.access_token ?? null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this line for? I can't find any documentation about this realtime.setAuth
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, this slipped in there because there is a realtime bug that I am debugging with the Supabase team where the auth token does not correctly propagate to realtime. Will take it out for now
No worries, hope your holidays were great!
Sounds good!
Yes, I've been using this for a while now in prod and it seems to have brought down the "Failed to fetch" errors in Sentry quite a bit. |
Types of changes
Description
I wanted something similar to ofetch retries for Supabase client too. This is because we are getting a lot of errors because of flaky requests. I could not figure out how to use ofetch directly for this so I built it manually. Do you have a better idea? Also, how should we make it configurable?
Checklist: