ClerkRequest.decodeCookieValue runs decodeURIComponent over the raw Cookie
header without a try/catch, so any malformed percent-escape in any cookie on
the domain throws inside the ClerkRequest constructor.
npm install
node repro.mjsURIError: URI malformed
at decodeURIComponent (<anonymous>)
at String.replace (<anonymous>)
at ClerkRequest.decodeCookieValue (.../@clerk/backend/dist/chunk-DDFIPK3V.mjs:6491:22)
at ClerkRequest.parseCookies (.../@clerk/backend/dist/chunk-DDFIPK3V.mjs:6487:57)
at new ClerkRequest (.../@clerk/backend/dist/chunk-DDFIPK3V.mjs:6450:25)
at createClerkRequest (.../@clerk/backend/dist/chunk-DDFIPK3V.mjs:6496:37)
No Clerk instance, publishable key, or network access is needed — the throw happens in a string function during construction, before any Clerk API call.
createClerkRequest is the entry point used by authenticateRequest, so
clerkMiddleware() fails the same way for real requests carrying such a cookie.