Skip to content

Conversation

@gegeemaa
Copy link

@gegeemaa gegeemaa commented Nov 21, 2025

Description

This PR fixes an issue where the SDK did not return a clear or useful error response when an API request failed.
Previously, the request() method threw an ApiException with the raw Response object, without parsing its JSON body.
As a result, applications could not access the actual error message returned by the Zitadel API.

This PR updates the method to parse the error body via response.json() and pass the parsed data into ApiException, enabling clearer debugging and proper error handling.


Related Issue

No official GitHub issue existed. This bug was discovered during real-world integration of the Zitadel Node SDK.


Motivation and Context

When the Zitadel API returned an error response (e.g., 400/401/404), the SDK exposed only a generic
Response returned an error code message.
Critical information—such as error codes, messages, or details returned by the Zitadel backend—was not available to the developer.

This made debugging and error handling difficult.

By parsing and forwarding the JSON error body, developers now receive:

  • meaningful error messages
  • proper Zitadel error codes
  • structured error metadata

This greatly improves the developer experience when using the SDK.

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