Skip to content

fix: Parse WorkOS error responses as JSON in API key creation - #1100

Closed
EmmaLouise2018 wants to merge 2 commits into
mainfrom
EmmaLouise2018/fix-api-key-creation
Closed

EmmaLouise2018 wants to merge 2 commits into
mainfrom
EmmaLouise2018/fix-api-key-creation

Conversation

@EmmaLouise2018

Copy link
Copy Markdown
Contributor

Summary

  • Fix API key creation error where WorkOS error responses were read as plain text then double-encoded via res.json(), hiding the actual error message from users
  • Now always attempts JSON.parse with text fallback so WorkOS error details are properly surfaced in the UI toast
  • Added warning-level logging when WorkOS rejects API key creation, including the full response for debugging

Test plan

  • Attempt to create an API key on the dashboard - verify the actual WorkOS error message is now shown in the toast instead of generic "Failed to create key"
  • Verify successful API key creation still works as expected
  • Verify API key listing (GET) still works
  • Verify API key revocation (DELETE) still works
  • Check server logs for the new warning log entry when creation fails

Error responses from WorkOS were read as text then double-encoded via
res.json(), hiding the actual error message from the frontend. Now
always attempts JSON.parse with text fallback so WorkOS error details
are properly surfaced to users.
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