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

API Gateway - Customise DEFAULT_5XX gateway response #3022

Open
dtmorgan opened this issue Nov 14, 2024 · 1 comment
Open

API Gateway - Customise DEFAULT_5XX gateway response #3022

dtmorgan opened this issue Nov 14, 2024 · 1 comment
Labels

Comments

@dtmorgan
Copy link

Amplify CLI Version

12.12.4

Question

I would like to customise the response template for DEFAULT_5XX gateway response (see image below).

Screenshot 2024-11-14 at 11 12 23 AM

I tried to override the API in my Amplify project by using the code following code but always fail to build the project.

export function override(
  resources: AmplifyApiRestResourceStackTemplate,
  amplifyProjectInfo: AmplifyProjectInfo
) {
  new CfnGatewayResponse(resources.restApi.stack, 'MyGatewayResponse', {
    restApiId: resources.restApi.ref,
    responseType: 'DEFAULT_5XX',
    statusCode: '500',
    responseTemplates: {
      'application/json': JSON.stringify({ message: 'Internal Error' }),
    },
  });
}
@AnilMaktala
Copy link
Member

Hey @dtmorgan , Thank you for bringing this up. Unfortunately, overriding the GatewayResponse is not currently supported. We are marking this as a future request for the team to evaluate further.

@AnilMaktala AnilMaktala added feature-request New feature or request and removed question Further information is requested pending-triage labels Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants