Skip to content

fix(auth): warn on deprecated lock option and prevent unhandled refresh rejection - #2627

Merged
mandarini merged 1 commit into
masterfrom
fix/lock-warn-and-refresh-rejection
Aug 24, 2026
Merged

mandarini merged 1 commit into
masterfrom
fix/lock-warn-and-refresh-rejection

Conversation

@mandarini

@mandarini mandarini commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Adds a one-time console.warn when the deprecated lock option is passed to the auth client, pointing at the lockless-coordination migration notes. The client has coordinated session refreshes without a lock since 2.107.0, and the option will be removed in v3, but the JSDoc-only deprecation was not reaching users still passing lock:.

Also pre-attaches a no-op rejection handler to the refresh dedupe deferred in _callRefreshToken: when a refresh fails with no concurrent callers awaiting it, the rejected deferred previously surfaced as an unhandled rejection even though the original caller received the error. Concurrent callers still observe the rejection through .promise.

Also fills in the release-time version placeholders in migrations/lockless-coordination.md and adds unit tests for both behaviors (warn once per realm, never without lock; no unhandled rejection on a single-caller refresh failure).

@coderabbitai

coderabbitai Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6043a2f1-03e9-4f57-b9f3-35c5a5f2cd41

📥 Commits

Reviewing files that changed from the base of the PR and between 6dbd224 and f87fc1c.

📒 Files selected for processing (4)
  • packages/core/auth-js/migrations/lockless-coordination.md
  • packages/core/auth-js/src/GoTrueClient.ts
  • packages/core/auth-js/test/GoTrueClient.lockWarning.test.ts
  • packages/core/auth-js/test/GoTrueClient.refreshRejection.test.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Deprecated custom lock warnings now appear only once, even when multiple clients use the option.
    • Prevented unhandled rejection reports when session refresh fails without concurrent callers.
    • Preserved correct error propagation during failed session refreshes.
  • Documentation

    • Updated lockless coordination migration guidance with current release and deprecation details.
  • Tests

    • Added coverage for warning deduplication and refresh failure handling.

Walkthrough

The auth client now emits the deprecated custom lock warning once per JavaScript realm. The migration document records the applicable releases and warning behavior. The refresh single-flight promise now prevents unhandled rejection reports when no concurrent caller awaits a failed refresh. Tests cover warning suppression, subscriber errors, caller rejection, and resource cleanup.

Merge Risk: ⚪ Minimal · up to f87fc

This PR adds a deprecation warning and prevents an unhandled refresh rejection while preserving concurrent refresh behavior; no actionable merge-blocking risk remains after normal checks and review.

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the auth-js Related to the auth-js library. label Aug 24, 2026
@mandarini
mandarini force-pushed the fix/lock-warn-and-refresh-rejection branch from dde001d to f87fc1c Compare August 24, 2026 09:51
@pkg-pr-new

pkg-pr-new Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@supabase/auth-js

npm i https://pkg.pr.new/@supabase/auth-js@2627

@supabase/functions-js

npm i https://pkg.pr.new/@supabase/functions-js@2627

@supabase/postgrest-js

npm i https://pkg.pr.new/@supabase/postgrest-js@2627

@supabase/realtime-js

npm i https://pkg.pr.new/@supabase/realtime-js@2627

@supabase/storage-js

npm i https://pkg.pr.new/@supabase/storage-js@2627

@supabase/supabase-js

npm i https://pkg.pr.new/@supabase/supabase-js@2627

commit: f87fc1c

@mandarini mandarini self-assigned this Aug 24, 2026
@mandarini
mandarini marked this pull request as ready for review August 24, 2026 09:54
@mandarini
mandarini requested review from a team as code owners August 24, 2026 09:54
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 81.676% (+0.09%) from 81.59% — fix/lock-warn-and-refresh-rejection into master

@mandarini
mandarini merged commit ff9909e into master Aug 24, 2026
31 of 32 checks passed
@mandarini
mandarini deleted the fix/lock-warn-and-refresh-rejection branch August 24, 2026 10:17
mandarini pushed a commit to supabase/ssr that referenced this pull request Aug 24, 2026
This PR updates `@supabase/supabase-js` to v2.112.4.

**Source**: supabase-js-stable-release

---

## Release Notes

## v2.112.4

## 2.112.4 (2026-08-24)

### 🩹 Fixes

- **auth:** convert stolen-lock AbortError when acquireTimeout is 0
([#2616](supabase/supabase-js#2616))
- **auth:** warn on deprecated lock option and prevent unhandled refresh
rejection ([#2627](supabase/supabase-js#2627))
- **postgrest:** move override fixtures out of generated types, repair
codegen ([#2605](supabase/supabase-js#2605))
- **realtime:** respect custom logger for send() REST fallback warning
([#2612](supabase/supabase-js#2612))

### ❤️ Thank You

- Katerina Skroumpelou @mandarini
- mmustafasenoglu @mmustafasenoglu

This PR was created automatically.

Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
mandarini added a commit to supabase/supabase that referenced this pull request Aug 25, 2026
This PR updates @supabase/*-js libraries to version 2.112.4.

**Source**: manual

**Changes**:
- Updated @supabase/supabase-js to 2.112.4
- Updated @supabase/auth-js to 2.112.4
- Updated @supabase/realtime-js to 2.112.4
- Updated @supabase/postgest-js to 2.112.4
- Refreshed pnpm-lock.yaml

---

## Release Notes

## v2.112.4

## 2.112.4 (2026-08-24)

### 🩹 Fixes

- **auth:** convert stolen-lock AbortError when acquireTimeout is 0
([#2616](supabase/supabase-js#2616))
- **auth:** warn on deprecated lock option and prevent unhandled refresh
rejection ([#2627](supabase/supabase-js#2627))
- **postgrest:** move override fixtures out of generated types, repair
codegen ([#2605](supabase/supabase-js#2605))
- **realtime:** respect custom logger for send() REST fallback warning
([#2612](supabase/supabase-js#2612))

### ❤️ Thank You

- Katerina Skroumpelou @mandarini
- mmustafasenoglu @mmustafasenoglu

This PR was created automatically.

Co-authored-by: mandarini <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auth-js Related to the auth-js library.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants