Files
twenty/packages
Sonarly Claude Code c903d614ca Unhandled pendingActivationUser auth context type in buildActorMetadata causes mutation failure during onboarding
https://sonarly.com/issue/14356?type=bug

Users in the onboarding/profile creation flow get a `pendingActivationUser` auth context that is not handled by `buildActorMetadata()`, causing all write mutations (like `UpdateOneWorkspaceMember`) to fail with an unhandled error.

Fix: Added handling for the `pendingActivationUser` auth context type in `buildActorMetadata()`. When a user is in the onboarding flow (at `/create/profile`), they don't yet have a `workspaceMember` record, so the middleware creates a `pendingActivationUser` auth context instead of a `user` context. The fix builds actor metadata from the user entity's `firstName`/`lastName` fields (available on `PendingActivationUserWorkspaceAuthContext.user`) with an empty `workspaceMemberId` since no workspace member exists yet.

Also improved the fallback error message to include `authContext.type`, so any future unhandled context types (e.g., `system`) will produce a more actionable error message for debugging.

Updated the existing test to cover the new `pendingActivationUser` case and updated the `system` type error assertion to match the new error message format.
2026-03-13 11:04:25 +00:00
..
2026-03-12 15:55:30 +01:00