Skip to content

Conversation

mandarini
Copy link
Contributor

What kind of change does this PR introduce?

Automatically initialize session on server client creation to trigger token refresh early in request lifecycle. This prevents race condition where refresh completes after response is sent, causing cookie errors. Also adds helpful error context before throwing if edge cases occur.

What is the current behavior?

Error: Cannot use `cookies.set(...)` after the response has been generated

Most possibly caused by token refresh.

What is the new behavior?

Initialize session to trigger token refresh early.

@mandarini mandarini force-pushed the fix/async-token-refresh-race-condition branch from dc11250 to 9c556eb Compare October 14, 2025 10:48
@mandarini mandarini requested a review from hf October 14, 2025 14:22
@mandarini mandarini self-assigned this Oct 14, 2025
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.

1 participant