CodeGenieApp / CodeGenieApp/serverless-express

Incompatibility with AWS API Gateway

Open
#662 8 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5.3k
Forks
676
PR merge metrics
No merged PRs in 30d

Description

Vendia's `serverless-express` package does not work as expected with AWS API Gateway, it only returns a blank screen instead the swagger screen.
This issue is forcing us to use the `serverless-http` package.

To reproduce the error, you basically have to:
1) Create an AWS Lambda function* with a simple project containing express, serverless-http or vendia and swagger;
2) Configure the AWS API Gateway to consume the Lambda function created in the step 1.

*Node versions tried: 14/16/18/20
BTW. Using AWS Lambda function URLs Vendia's `serverless-express` package works pretty fine with swagger.

Example of a simple project containing express, serverless-http or vendia and swagger:
```
const express = require('express')
const serverless = require('serverless-http')
const swaggerUI = require('swagger-ui-express')

const app = express()
app.use(
'/swagger',
swaggerUI.serve,
swaggerUI.setup(null, {
swaggerOptions: {
url: "https://petstore.swagger.io/v2/swagger.json"
}
})
)

module.exports.handler = serverless(app)

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.