Skip to content

fix(auth): downgrade stale refresh token console noise - #2559

Merged
mandarini merged 1 commit into
supabase:masterfrom
7ttp:fix/auth-js-initial-session-log-level
Jul 27, 2026
Merged

mandarini merged 1 commit into
supabase:masterfrom
7ttp:fix/auth-js-initial-session-log-level

Conversation

@7ttp

@7ttp 7ttp commented Jul 24, 2026 •

Copy link
Copy Markdown
Member

TL;DR

_emitInitialSession already warns instead of erroring for a missing session or a retryable fetch failure.
a dead refresh token
(refresh_token_not_found, refresh_token_already_used, session_expired) still hit raw console.error even
though it's the same kind of expected outcome on page load....

this just widens that same check to cover those three codes too.

ref:

@7ttp
7ttp requested review from a team as code owners July 24, 2026 14:49
@coderabbitai

coderabbitai Bot commented Jul 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: a5a6078a-c416-4ac4-b5c0-37875a864deb

📥 Commits

Reviewing files that changed from the base of the PR and between ebefc44 and 088ee6d.

📒 Files selected for processing (2)
  • packages/core/auth-js/src/GoTrueClient.ts
  • packages/core/auth-js/test/GoTrueClient.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/core/auth-js/test/GoTrueClient.test.ts
  • packages/core/auth-js/src/GoTrueClient.ts

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of refresh-token expiration or reuse during initial authentication.
    • Initial-session failures for specific expired/rotated refresh-token cases now surface as warnings instead of errors, reducing console noise.
  • Tests

    • Added coverage to confirm expired or rotated refresh-token scenarios produce console.warn (and not console.error).

Walkthrough

_emitInitialSession now treats refresh_token_not_found, refresh_token_already_used, and session_expired as non-application failures, logging them with console.warn instead of console.error. A regression test verifies that an expired or rotated refresh-token failure emits a warning without an error.

Assessment against linked issues

Objective Addressed Explanation
Accept an optional external log handler as an alternative to direct console calls [#2558] ❌ No injectable logger or external log-handler option was added.
Downgrade the listed transient refresh-token failures in _emitInitialSession [#2558] ❌ session_not_found, also listed in the issue’s suggested fix, is not handled.

Possibly related PRs

  • supabase/supabase-js#2544: Also changes _emitInitialSession logging for transient auth failures and tests warning-versus-error behavior.

Suggested labels: auth-js

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: lockfile failed supply-chain policy check. Run pnpm install locally to update the lockfile.


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.

@pkg-pr-new

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

Copy link
Copy Markdown

Open in StackBlitz

@supabase/auth-js

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

@supabase/functions-js

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

@supabase/postgrest-js

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

@supabase/realtime-js

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

@supabase/storage-js

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

@supabase/supabase-js

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

commit: 088ee6d

@mandarini

mandarini commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

@7ttp thanks for this PR,let's wait for my other PR to be merged and you rebase

@7ttp
7ttp force-pushed the fix/auth-js-initial-session-log-level branch from 0edafa8 to ebefc44 Compare July 27, 2026 10:12
@mandarini

Copy link
Copy Markdown
Contributor

let's wait for this now #2564

@7ttp
7ttp force-pushed the fix/auth-js-initial-session-log-level branch from ebefc44 to 088ee6d Compare July 27, 2026 11:55
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 76.62% (-0.03%) from 76.648% — 7ttp:fix/auth-js-initial-session-log-level into supabase:master

@mandarini
mandarini merged commit 92a8bce into supabase:master Jul 27, 2026
23 checks passed
@7ttp
7ttp deleted the fix/auth-js-initial-session-log-level branch July 27, 2026 12:11
mandarini pushed a commit to supabase/supabase that referenced this pull request Jul 27, 2026
This PR updates @supabase/*-js libraries to version 2.110.9.

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

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

---

## Release Notes

## v2.110.9

## 2.110.9 (2026-07-27)

### 🩹 Fixes

- **auth:** downgrade stale refresh token console noise
([#2559](supabase/supabase-js#2559))
- **realtime:** preserve presence refs
([#2566](supabase/supabase-js#2566))
- **repo:** override sharp to >=0.35.0 to clear libvips advisory
([#2548](supabase/supabase-js#2548))
- **repo:** populate symbols in sdk-compliance so capabilities are
verifiable ([#2547](supabase/supabase-js#2547))
- **repo:** bump postcss, babel, next to clear audit advisories
([#2561](supabase/supabase-js#2561))

### ❤️ Thank You

- Katerina Skroumpelou @mandarini
- Vaibhav @7ttp

This PR was created automatically.

Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
mandarini pushed a commit to supabase/ssr that referenced this pull request Jul 27, 2026
This PR updates `@supabase/supabase-js` to v2.110.9.

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

---

## Release Notes

## v2.110.9

## 2.110.9 (2026-07-27)

### 🩹 Fixes

- **auth:** downgrade stale refresh token console noise
([#2559](supabase/supabase-js#2559))
- **realtime:** preserve presence refs
([#2566](supabase/supabase-js#2566))
- **repo:** override sharp to >=0.35.0 to clear libvips advisory
([#2548](supabase/supabase-js#2548))
- **repo:** populate symbols in sdk-compliance so capabilities are
verifiable ([#2547](supabase/supabase-js#2547))
- **repo:** bump postcss, babel, next to clear audit advisories
([#2561](supabase/supabase-js#2561))

### ❤️ Thank You

- Katerina Skroumpelou @mandarini
- Vaibhav @7ttp

This PR was created automatically.

Co-authored-by: supabase-workflow-trigger[bot] <266661614+supabase-workflow-trigger[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Accept external log handler (as an alternative to direct console.error calls)

3 participants