-
Notifications
You must be signed in to change notification settings - Fork 401
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
Bug: Swagger UI doesn't load : Loading... with Uncaught SyntaxError #3552
Comments
Hi @filol can you show me the Network tab of the browser to see which URL is giving out that "Syntax error" error? |
But I found the problem ! I have inspected the files receives and each time it was the HTML content even for the js & css file. It was related to the API cache that was enable. Not sure you can do something about it. Just maybe display this info on the documentation |
Awesome! So in this case, |
@rubenfonseca Yes ! See the file selected in my 2nd screenshot. It's |
Interesting! Let's keep the issue open so we can add a note in the documentation. Thank you for this! |
Hey everyone! I was reading this issue to see if we can help on the Powertools side, but I don't think we can do anything. Just to clarify the issue and help us decide the next steps: 1 - Amazon API Gateway caches values based on the resource name and/or query string parameters. In this case, the cache will store the 2 - Amazon API Gateway does not depend on/use any header sent by downstream integration, in this case Lambda. The cache must be invalidated by the client, so we have nothing to do on the server side.
3 - You can solve this by creating specific resources for each path, like this: 4 - I found another small problem when we served the CSS/JS from Powertools. In the files So, as the next steps we have: 1 - Update our documentation to clarify the issue when using I will work on both items and submit a PR. Thanks again for opening this issue @filol and helping us make Powertools for AWS Lambda even better for our customers. Please let me know if you have any questions. |
We've modified the PR and we'll inject CSS and JS inline into the SwaggerUI HTML file. This way we reduce the number of Lambda invocations, optimize code execution, and fix caching issues. |
|
This is now released under 2.32.0 version! |
Expected Behaviour
Having swagger UI displayed
Current Behaviour
Uncaught SyntaxError: Unexpected token '<' (at swagger.js:1:1)
swagger:543 Uncaught ReferenceError: SwaggerUIBundle is not defined
at swagger:543:7
Code snippet
Possible Solution
No response
Steps to Reproduce
Having a lambda behind a edge API Gateway with a proxy+ to the lambda
Powertools for AWS Lambda (Python) version
latest
AWS Lambda function runtime
3.11
Packaging format used
Lambda Layers, PyPi
Debugging logs
The text was updated successfully, but these errors were encountered: