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
The Swagger UI is failing to display any content on the Amazon EC2 instance. #74
Comments
Thanks for reporting! Unfortunately, the steps you are providing are far from being useful to diagnose and debug this. We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that. |
Sounds similar to fastify/fastify-swagger#397 |
Does anyone have a solution to this problem? I'm having the same problem with swagger ui, locally it works correctly but when I deploy on AWS Cloudformation (i'm using fastify lambda) I get the 504 Gateway Timeout error. This is my own configuration:
|
I also seem to be getting the same issue with AWS lambda, works fine locally but then when coming through lambda and Apigateway I get a blank page. |
In my case I solved the problem by increasing the API_TIMEOUT parameter. I set a generic timeout on my API so that they would respond with a 504 in case the server did not respond within a certain time, i think that due to the cold start of the lambda function the call to the /docs/static/index.html page took longer than the API_TIMEOUT and therefore didn't render the page correctly, I hope it helps
|
Can you confirm that the static assets are available on your server? Do you bundle your api? |
Prerequisites
Fastify version
4.0.0
Plugin version
1.8.0
Node.js version
18.15.0
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
13.3.1 (a)
Description
A Node.js application utilizing the Fastify framework, and api is documented using "fastify-swagger" and "fastify-swagger-ui". The Swagger UI loads seamlessly on my local server at "localhost:3000/v1/docs" and operates without any issues.
However, when I deployed the application to an Amazon EC2 instance (running on Amazon Linux), I encountered a problem. Although all APIs function correctly on the server, navigating to "myamazonurl.com/docs/static/index.html" redirects me to the Swagger UI, which, unfortunately, does not display anything.
The console and network are both displaying errors that seem identical.
Steps to Reproduce
Develop a Node.js Application: Firstly, develop a Node.js application using the Fastify framework.
Document using fastify-swagger and fastify-swagger-ui: After developing the application, proceed to document it using "fastify-swagger" and "fastify-swagger-ui".
Test on Local Server: Run the application on your local server and access the Swagger UI by navigating to "localhost:3000/docs/static/index.html". Check if it is working properly.
Deploy the Application on Amazon EC2 Instance: Now, deploy the application to an Amazon EC2 instance (running Amazon Linux).
Test APIs: After deploying, check if all APIs are hitting the server correctly and functioning as expected.
Access Swagger UI on EC2 Instance: Finally, attempt to access the Swagger UI on the EC2 instance by visiting "myamazonurl.com/docs/static/index.html". The issue occurs here, as it redirects to the Swagger UI, but nothing is displayed.
Check Console and Network Errors: Inspect the console and network for any errors. The same errors seem to appear on both.
I have attached these errors for further clarification.
Expected Behavior
Swagger UI should be accessible and displayed correctly on the EC2 instance, and the server itself should not force itself to find resources(Swagger resources) on the HTTPS scheme.
The text was updated successfully, but these errors were encountered: