CodeGenieApp / CodeGenieApp/serverless-express

ALB responds with HTTP code 502

Open
#688 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5.3k
Forks
676
PR merge metrics
No merged PRs in 30d

Description

Hey, I am attempting to deploy a small Express app to AWS as a Lambda connected to ALB via target group.

```javascript
const serverless = require('@codegenie/serverless-express')
const express = require('express')

const app = express()

app.get('/200', function(req, res) {
res.json({ message: 'all good' })
})

app.get('/404', function(req, res) {
res.status(404).json({ message: 'not found' })
})

app.post('/test', function(req, res) {
res.sendStatus(400)
})

module.exports.handler = serverless({ app })
```
I am able to successfully make a request to `/200` and see the JSON response but I am not successful with requests that modify the `status`. In those I just see this response from ALB:
```html

502 Bad Gateway


502 Bad Gateway


```

Can I please ask for guidance how would I go about debugging this? I don't see anything useful in my Cloudwatch logs of the Lambda function. Should I enable ALB logs?

Thank you.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.