Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Response Body being discarded #476

Open
TCap103 opened this issue Mar 17, 2023 · 4 comments
Open

Error Response Body being discarded #476

TCap103 opened this issue Mar 17, 2023 · 4 comments
Assignees

Comments

@TCap103
Copy link

TCap103 commented Mar 17, 2023

When using ManageEventWithContext if there is a response error we only get the error code and the high level error message back. For example: "HTTP response failed with status code 400 and no JSON error object was present".

From inspecting with curl I know there actually is a detailed error message. It appears that the APIError that we're attempting to decode into in client.getErrorFromResponse expects the response.Body to have the json key error however the body is actually (in my test example): {"errors":["'payload.source' is missing or blank"],"message":"Event object is invalid","status":"invalid event"}

I do not know if doWithEndpoint's other usages suffer from the same issue, or actually match the currently implemented behavior as I do not use those flows.

Currently working around this by using the debug methods to decode the response properly in my own code.

@ChuckCrawford
Copy link
Collaborator

@TCap103 : would you mind letting us know which API(s) you are working with that are returning an "errors" key?

@adamdecaf
Copy link

adamdecaf commented Apr 19, 2023

I am seeing this when sending a v2 event and payload with ManageEventWithContext . See moov-io/achgateway#171 for our issue tracking this.

Code: https://github.com/moov-io/achgateway/blob/master/internal/alerting/pagerduty.go#L32

Edit: Should we use .CreateEventWithContext(ctx, event) instead of ManageEventWithContext? We're just looking to trigger pages for on-call staff.

Edit2: I'm seeing the DebugFlag options, but am not finding a response body or v2 error response. Is there a better option to get full details why a v2 event couldn't be created?

Sometimes I was able to get a Invalid routing key response in plain text (aka no JSON response object).

HTTP response with status code 400 does not contain Content-Type: application/json

adamdecaf added a commit to moov-io/achgateway that referenced this issue Apr 21, 2023
@ChuckCrawford
Copy link
Collaborator

@adamdecaf : did you see improvement here after the introduction of this PR into v1.6.0 and beyond?

@ChuckCrawford
Copy link
Collaborator

Same for @TCap103 : did you see improvement here after the introduction of this PR into v1.6.0 and beyond?

@ChuckCrawford ChuckCrawford self-assigned this Dec 12, 2023
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

No branches or pull requests

3 participants