소스 검색

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.
John Richmond 5 달 전
부모
커밋
e78d9541ca
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      packages/cloud/src/auth/WebAuthService.ts

+ 1 - 1
packages/cloud/src/auth/WebAuthService.ts

@@ -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}`)