5

That's the error data returned from App Sync AWS: { "data": { "getContentById": null }, "errors": [ { "path": [ "getContentById" ], "data": null, "errorType": "Lambda:Handled", "errorInfo": null, "locations": [ { "line": 1, "column": 2, "sourceName": null } ], "message": "ID is not found" } ] } How can I change the 200 Status code from my lambda function? Screen shot from PostMan

1

1 Answer 1

2

Currently you cannot customize the error status code in AWS AppSync. The suggested approach is to use errorType in the error response. You can use $util.appendError or $util.error methods in your velocity mapping template to define the error type.

Sign up to request clarification or add additional context in comments.

4 Comments

do you know if there are plans to implement this feature? Do you know if there is a roadmap to see how likely is some feature to be implemented, or even to propose one?
Is this answer still the case? I'm not a fan
@greenie-beans i am considering dropping aws appsync because of these silly design decisions
i'm pretty sure that graphql sends 200 responses for everything by default. we ended up creating some custom errors based on the parent answer, and then the client parsed out any errors based on the errors key. this blog post has some background on graphql and errors: sachee.medium.com/200-ok-error-handling-in-graphql-7ec869aec9bc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.