Bugfix: Cloud: be more specific about session error codes (#6051)

InvalidClientTokenError indicates an unrecoverable state for
the session, so we need to be more exact about triggering it. A recent
Clerk outage resulted in a lot of 429 responses which should really cause
inactive-session, not a full clear to logged-out.
This commit is contained in:
John Richmond 2025-07-22 07:16:15 -07:00 committed by GitHub
parent df6c57d293
commit e78d9541ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -494,7 +494,7 @@ export class WebAuthService extends EventEmitter<AuthServiceEvents> implements A
signal: AbortSignal.timeout(10000),
})
if (response.status >= 400 && response.status < 500) {
if (response.status === 401 || response.status === 404) {
throw new InvalidClientTokenError()
} else if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`)