You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: retry session refresh when organizationId is missing (#2564)
When a user signs up, there's a race condition where the webhook that
creates the user's organization may not have processed yet. This results
in the JWT not having an org_id claim, causing WorkOS API calls to fail
with "organization_id must be a string".
This change adds retry logic to requireAuth() that:
- Detects when organizationId is missing from the session
- Refreshes the session up to 3 times with 1s delay between attempts
- Gives the webhook time to process and assign the organization
- Throws a clear error if org is still missing after retries
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
0 commit comments