question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nuxt 3.0.0-rc.9 with Nitro 0.5.0 configuration error: Malformed Lambda proxy response

See original GitHub issue

Environment

Nuxt 3.0.0-rc.9 with Nitro 0.5.0

Reproduction

I build the Nuxt app with aws-lambda deployment setting and configured Amazon API Gateway proxy integration to work with this lambda function. When I call my endpoint, I receive a configuration error and an HTTP 502 status code.

Execution failed due to configuration error: Malformed Lambda proxy response

Describe the bug

As I commented in the PR (https://github.com/unjs/nitro/pull/357#issuecomment-1247562089), this is due to the fact that cookies are returned in the response object.

For API Gateway to handle a Lambda function’s response, the function must return output according to the following JSON format. Additional fields are not allowed.

{
    "isBase64Encoded": true|false,
    "statusCode": httpStatusCode,
    "headers": { "headerName": "headerValue", ... },
    "body": "..."
}

cf. https://aws.amazon.com/premiumsupport/knowledge-center/malformed-502-api-gateway/?nc1=h_ls

Additional context

Related Issues and PRs are as follows.

Logs

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
danielroecommented, Sep 15, 2022

Yes, Nitro presets are fully extensible. Copy this file into your project, make the necessary changes, and set nitro.entry to point to your changed file…

(Of course, we do plan to fix the issue in Nitro itself!)

1reaction
datake914commented, Oct 21, 2022

@timmak I am using Nuxt 3.0.0-rc.11 with Nitro 0.5.4 and it works fine.

I specify in nuxt.config.ts to use custom nitro.entry.ts only when process.env.NODE_ENV is production.

  nitro: {
    preset: 'aws-lambda',
    serveStatic: false,
    entry: process.env.NODE_ENV === 'production' ? 'nitro.entry.ts' : undefined,
  },
Read more comments on GitHub >

github_iconTop Results From Across the Web

3.0.0-rc.9 AWS Lambda SSR is broken with No match ... - GitHub
When I check the AWS Lambda logs, it returns this error, "No match found for location with path "/images/icons/gear.png" and is causing the...
Read more >
Malformed Lambda Proxy Response — What causes it and ...
First, Malformed Lambda proxy response isn't really a configuration error because the problem lies in your Lambda code.
Read more >
AWS lambda api gateway error "Malformed Lambda proxy ...
Usually, when you see Malformed Lambda proxy response , it means your response from your Lambda function doesn't match the format API ......
Read more >
Search Results - CVE
A stack overflow vulnerability exists in /goform/setAutoPing in Tenda W6 V1.0.0.9(4122), which allows an attacker to construct ping1 parameters and ping2 ...
Read more >
datake914 - Twitter
Nuxt 3.0.0-rc.9 with Nitro 0.5.0 configuration error: Malformed Lambda ... configured Amazon API Gateway proxy integration to work with this lambda functi.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found