Uh oh!
There was an error while loading. Please reload this page.
Include clerkTraceId for backend api errors - #1894
Conversation
🦋 Changeset detectedLatest commit: 1c04f6c The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
c1305f8 to
5f4fadeCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
georgepsarakis
left a comment
There was a problem hiding this comment.
Nice work @Nikpolik 👏 !
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
c5d6fc0 to
83f200aCompare83f200a to
99d6b0eCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
7dfdf84 to
16b44aaCompareclerkTraceId is used when available and defaults to cloudflares CF Ray id when its missing.
16b44aa to
1c04f6cComparedimkl
commented
Oct 30, 2023
@Nikpolik Could you also cherry-pick this change into |
…1894) clerkTraceId is used when available and defaults to cloudflares CF Ray id when its missing.
Description
This PR adds
clerkTraceIdinClerkBackendApiResponse. This can help debug issues with API responses especially when errors happen server side or transiently and they can't be viewed in the console.Changes
ClerkAPIResponseErrorfrom@clerk/shared.ClerkBackendApiResponseinterface to includeclerkTraceIdwhen available.clerkTraceIdeither from backend error response or headers inbuildRequest.clerkTraceIdvalue towithLegacyReturnand then to the constructor ofClerkAPIResponseError.toStringforClerkAPIResponseErrorso it can also log the clerkTraceId.Now callining
.toString()on an error should show the trace idThe same is true for simply calling console.log on the error
Notes
DX is a bit weird here since fields that are different between success and error cannot be accessed by default in typescript and they do not appear in code completion(intelisense/language server). They can be accessed however by
checking if they exist in the object.
Checklist
npm testruns as expected.npm run buildruns as expected.Type of change
Packages affected
@clerk/clerk-js@clerk/clerk-react@clerk/nextjs@clerk/remix@clerk/types@clerk/themes@clerk/localizations@clerk/clerk-expo@clerk/backend@clerk/clerk-sdk-node@clerk/shared@clerk/fastify@clerk/chrome-extensiongatsby-plugin-clerkbuild/tooling/chore