Skip to content

fix: Parse WorkOS error responses in API key proxy - #1102

Merged
bokelley merged 1 commit into
mainfrom
bokelley/fix-api-key-creation
Feb 16, 2026
Merged

bokelley merged 1 commit into
mainfrom
bokelley/fix-api-key-creation

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Summary

  • Fix double-encoding of WorkOS error responses in the API key creation/revocation proxy
  • callWidgetApi was reading error responses as text() then forwarding via res.json(), which double-encoded the JSON string — the frontend couldn't extract .message from a string, so it showed a generic "Failed to create key" toast
  • Now parses all responses through JSON.parse() with fallback for non-JSON responses
  • Adds warn-level logging for non-2xx WorkOS responses on both create and revoke
  • Handles 204 No Content properly on DELETE (no body)

Test plan

  • All 297 tests pass
  • TypeScript compiles cleanly
  • Verified fix end-to-end locally via Docker + Vibium browser test
  • Confirmed toast now shows actual WorkOS error message instead of generic fallback
  • Test API key creation on staging with a real WorkOS organization

🤖 Generated with Claude Code

Error responses from the WorkOS widget API were read as text() then
forwarded via res.json(), double-encoding the JSON string. The frontend
couldn't extract .message from a string, so it showed a generic
"Failed to create key" instead of the actual error.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@bokelley
bokelley merged commit 846aeae into main Feb 16, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant