Skip to content

Commit 90d64a9

Browse files
d-csclaude
andcommitted
fix(webapp): give PAT-authenticated requests user.id in sentry events
createLoaderPATApiRoute was the only authenticated builder not stamping the scope with the request's user — PAT auth carries `userId` but not an AuthenticatedEnvironment, so the other builders' `tenantContext.run` pattern doesn't apply. Enrich the scope established by the Express middleware with the user id so Sentry events from PAT routes get user-level attribution. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6673298 commit 90d64a9

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

apps/webapp/app/services/routeBuilders/apiBuilder.server.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,11 @@ export function createLoaderPATApiRoute<
594594
}
595595
}
596596

597+
// PAT auth carries `userId` but no environment — enrich the scope
598+
// the Express middleware established with the authenticated user so
599+
// Sentry events from this handler get user-level attribution.
600+
tenantContext.enrich({ userId: authenticationResult.userId });
601+
597602
const result = await handler({
598603
params: parsedParams,
599604
searchParams: parsedSearchParams,

0 commit comments

Comments
 (0)