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

Incompatibility with AWS API Gateway #662

Open
gustavolaranjeira opened this issue Nov 21, 2023 · 8 comments
Open

Incompatibility with AWS API Gateway #662

gustavolaranjeira opened this issue Nov 21, 2023 · 8 comments

Comments

@gustavolaranjeira
Copy link

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)
@brettstack
Copy link
Collaborator

Thanks for the report! I'll take a look and update you.

@murilo09
Copy link

murilo09 commented Nov 22, 2023

Same problem here, I solved it using serverless-http.

@brettstack
Copy link
Collaborator

brettstack commented Nov 22, 2023

Did this only just start happening? Is it only an issue when using Swagger UI?

@murilo09
Copy link

Did this only just start happening? Is it only an issue when using Swagger UI?

I had never used serverless-express with swagger-ui-express and API Gateway but when I tried it (monday) I had this problem with the blank screen on the swagger route.

@gustavolaranjeira
Copy link
Author

Did this only just start happening? Is it only an issue when using Swagger UI?

If you use AWS Lambda function URLs with Vendia's serverless-express package works pretty fine with Swagger but if use with AWS API Gateway It returns a blank screen on the doc page.

@thetumper
Copy link

Related to #400?

@gustavolaranjeira
Copy link
Author

Related to #400?

No, it's not!

@H4ad
Copy link
Contributor

H4ad commented Dec 15, 2023

I already got an error like this and it was caused by low lambda concurrency, below 5 the Swagger will not render, maybe is not related but try to check the concurrency.

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

5 participants