feat(auth): add skipAutoInitialize option to prevent constructor auto-init#2123
feat(auth): add skipAutoInitialize option to prevent constructor auto-init#2123
Conversation
@supabase/auth-js
@supabase/functions-js
@supabase/postgrest-js
@supabase/realtime-js
@supabase/storage-js
@supabase/supabase-js
commit: |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. Comment |
* fix(postgrest): enforce type safety for table and view names in from() method (supabase#2058) * docs(auth): clarify updateUserById does not trigger client listeners (supabase#2114) * fix(auth): resolve Firefox content script Promise.then() security errors in locks (supabase#2112) * build(deps): bump qs from 6.14.1 to 6.14.2 in the npm_and_yarn group across 1 directory (supabase#2118) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(release): version 2.96.0 changelogs (supabase#2121) Co-authored-by: supabase-releaser[bot] <supabase-releaser[bot]@users.noreply.github.com> * docs(supabase): document UNUSED_EXTERNAL_IMPORT build warning as false positive (supabase#2122) * feat(auth): add skipAutoInitialize option to prevent constructor auto-init (supabase#2123) * chore(release): version 2.97.0 changelogs (supabase#2124) Co-authored-by: supabase-releaser[bot] <supabase-releaser[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Vaibhav <[email protected]> Co-authored-by: Katerina Skroumpelou <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com> Co-authored-by: supabase-releaser[bot] <supabase-releaser[bot]@users.noreply.github.com>
Problem
Currently,
GoTrueClientconstructor automatically callsthis.initialize()as a fire-and-forget promise. This starts async operations (URL detection, session recovery, token refresh) immediately without waiting for completion.In SSR contexts, this causes a race condition:
initialize()promise (doesn't await)Error: Cannot use cookies.set(...) after the response has been generatedSolution
Add
skipAutoInitializeoption toGoTrueClientOptionsthat:true: Skip automaticinitialize()call in constructorfalse(default): Maintain existing auto-initialization behaviorChanges
skipAutoInitialize?: booleantoGoTrueClientOptionsinterfaceDEFAULT_OPTIONSwithskipAutoInitialize: falseRelated
@supabase/ssr(and other SSR integrations) to prevent race conditions by settingskipAutoInitialize: trueand controlling initialization timing within the request lifecycle.