0

When I send request with wrong x-api-key, I get default response as

{
  "message": "Forbidden"
}

I can modify error response from lambda if it hits my lambda function. But in this case aws sends default error response.

I have different error format for my endpoint

{
  type:"error",
  "message":"...",
  "status":"...",
  "code":403,
  ...
}

Is there any way to change to above format?

1 Answer 1

4

There is a new feature within API gateway where you can define default responses for various errors.

enter image description here

Documention for this feature is over here:

API Gateway Responses

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

1 Comment

Gr8, till yesterday, this was not available, Thanks.

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.