fix: fix errors from sentry#72
Merged
Merged
Conversation
scotwells
approved these changes
Apr 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes three categories of production Sentry errors on the login UI:
/accountsand/logout— ProtobufSessionobjects passed as props to client components/idp/[provider]/success— Re-render after server action re-fetches a consumed intentignoreErrorsChanges
1. Fix protobuf Session serialization across RSC boundary
Error:
Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported.Root cause: The
/accountsand/logoutserver components fetchSession[]protobuf objects (which containbiginttimestamps and null-prototype internal fields) and pass them directly as props to"use client"components. React Server Components cannot serialize these across the boundary.Fix:
apps/login/src/lib/serialize.ts(new) —toPlainObject()helper that deep-clones viaJSON.parse(JSON.stringify())with BigInt-to-Number conversion, stripping null prototypes and non-serializable fieldsapps/login/src/app/(main)/(boxed)/accounts/page.tsx— WraploadSessions()result withtoPlainObject()before passing to<SessionsList>apps/login/src/app/(main)/(boxed)/logout/page.tsx— Same fix for<SessionsClearList>apps/login/src/lib/server/session.ts— RefactoredcontinueWithSessionto accept{ sessionId, loginName, organizationId, requestId }instead of the fullSessionprotobuf object, avoiding serialization issues on the client-to-server-action boundaryapps/login/src/components/session-item.tsx— UpdatedcontinueWithSessioncall site to pass only the needed fields2. Handle consumed IDP intent on re-render
Error:
ConnectError: [failed_precondition] Intent has not succeededRoot cause: After the IDP success page renders and the
<IdpSignin>client component calls thecreateNewSessionFromIdpIntentserver action (which consumes the intent), Next.js re-renders the server component as part of the action response. This re-render callsretrieveIDPIntentagain with the sameid/token, but the intent has already been consumed.Fix:
apps/login/src/app/(main)/(boxed)/idp/[provider]/success/page.tsx— WrappedretrieveIDPIntentin a try-catch. If the error isFAILED_PRECONDITION(code 9), it returns a benign message vialoginFailed()instead of throwing. Other errors are re-thrown.3. Suppress framework-level Sentry noise
Errors:
The router state header was sent but could not be parsed— Malformed RSC requests from bots/crawlers sending invalidNext-Router-State-TreeheaderstransformAlgorithm is not a function— Node.js 20.xTransformStreamrace condition during RSC streaming (client disconnect mid-stream)Fix:
apps/login/sentry.server.config.ts— Added both patterns toignoreErrors