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

ALB responds with HTTP code 502 #688

Open
marovargovcik opened this issue Aug 9, 2024 · 1 comment
Open

ALB responds with HTTP code 502 #688

marovargovcik opened this issue Aug 9, 2024 · 1 comment

Comments

@marovargovcik
Copy link

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

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>

<head>
    <title>502 Bad Gateway</title>
</head>

<body>
    <center>
        <h1>502 Bad Gateway</h1>
    </center>
</body>

</html>

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.

@brettstack
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants