forked from zitadel/typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Problem
Users are intermittently experiencing authentication failures when using external identity providers (Google, GitHub, etc.) with the error:
ConnectError [failed_precondition] Intent has not succeeded (IDP-nme4gszsvx)
Root Cause Analysis
Primary Cause: Zitadel Multi-Replica Race Condition
The error originates from Zitadel's backend (internal/api/grpc/user/v2/intent.go) when retrieveIdentityProviderIntent is called before the intent has transitioned to the Succeeded state.
Known Issue: zitadel/zitadel#10932
When running multiple Zitadel replicas:
- User completes IDP authentication → callback processed by Replica A
- Intent transitions to
Succeededstate in event store auth-uicallsRetrieveIdentityProviderIntentwhich hits Replica B- Replica B hasn't synced the event yet
- Intent appears as
Started→ Error thrown
Fixed in: Zitadel v4.6.2 (PR #11014)
Secondary Cause: Missing Error Handling in auth-ui
In apps/login/src/app/(main)/(boxed)/idp/[provider]/success/page.tsx at line 149:
const intent = await retrieveIDPIntent({
serviceUrl,
id,
token,
});This call has no try-catch block. When Zitadel returns the failed_precondition error, it propagates as an unhandled exception.
Proposed Solution
Short-term Fix (auth-ui)
- Add error handling around
retrieveIDPIntent()call - Implement retry logic with exponential backoff for the race condition
- Provide user-friendly error message with retry option
let intent;
try {
intent = await retrieveIDPIntentWithRetry({
serviceUrl,
id,
token,
});
} catch (error) {
Sentry.captureException(error, {
tags: { flow: 'idp_intent_retrieval', provider },
extra: { intentId: id },
});
if (error?.message?.includes('IDP-nme4gszsvx')) {
return loginFailed("Authentication is still processing. Please try again.");
}
return loginFailed("Authentication failed. Please try again.");
}Long-term Fix
Upgrade Zitadel from v3.3.2 to v4.6.2+ which contains the race condition fix.
Affected Files
| File | Lines | Issue |
|---|---|---|
apps/login/src/app/(main)/(boxed)/idp/[provider]/success/page.tsx |
149-153 | Missing error handling |
apps/login/src/lib/zitadel.ts |
1329-1347 | retrieveIDPIntent() - no retry logic |
Related Issues
- zitadel/zitadel#10932 - Race conditions when running multiple Zitadel replicas
- zitadel/zitadel#11014 - Fix: locking behavior based on configuration
Labels
- bug
- authentication
- idp
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels