1

I'm creating an API rest using express, and for the documentation I'm using swagger-ui-express, when deploying my code to the aws lambda every endpoint is accesible from the API gateway, except the endpoint where the documentation is returned.

I'm using the swagger-ui-express package to deploy the documentation, this works perfectly fine if I run the app locally

this is the code I'm using to create the endpoint that exposes the swagger ui

const specs = swaggerJsdoc(swaggerJSON);
this.server.use("/docs", swaggerUi.serve, swaggerUi.setup(specs));

I'm using a {proxy+} resource in the aws api gateway so that all methods and paths are accesible by the express api, just like this:

enter image description here

when deploying my api gateway into a stage,this stage is added to the path, so if I have a route /user to be able to access this route from the API gateway I need to add the stage /dev/user and it works fine, but If I try to access the /dev/docs path to get the documentation I noticed that the path is automatically changed to just /docs and the api gateway throws am 403 error.

enter image description here

Does anybody knows how to fix this issue?

0 Answers0