Surnet / swagger-jsdoc

Generates swagger/openapi specification based on jsDoc comments and YAML files.
MIT License
1.66k stars 224 forks source link

totally does not load on production #379

Open m0x61h0x64i opened 10 months ago

m0x61h0x64i commented 10 months ago

Hi, yesterday I could load my swagger docs using its URL, but today when i committed my new changes it no longer loads my swagger docs on production, but on the development everything works fine.

my last commit was on Jul 3, at that moment until new commit which was today i dint have problem because yesterday docs loaded fine

after i pushed my new commit today, swagger does not load on production, i can see some errors in the console :

image

swagger-ui-bundle.js:3 Uncaught SyntaxError: Unexpected token '<' (at swagger-ui-bundle.js:3:1)
swagger-ui-standalone-preset.js:3 Uncaught SyntaxError: Unexpected token '<' (at swagger-ui-standalone-preset.js:3:1)
DevTools failed to load source map: Could not load content for https://*/api-docs/swagger-ui.css.map: Unexpected token '<', "
<!-- HTML "... is not valid JSON
swagger-ui-init.js:58 Uncaught ReferenceError: SwaggerUIBundle is not defined
    at window.onload (swagger-ui-init.js:58:7)

I have tried disabling all routes, cause i have written new routes and docs, but that didnt help.

now this is my localhost : image

and this is my production swagger : image

swagger-jsdoc version : 6.2.8 swagger-ui-express version : 5.0.0 hosting: vercel

my problem wont be my code, i have checked my Jul 3 commit and it is the same code as it is and also i removed the routes to test if it can be loaded or not but it didnt load swagger doc on production.

EDIT: I have gone to my Jul 3 commit which was the working state of the swagger doc, and it works.

I found the bug, the bug here is that the new version of swagger-ui-express is not compatible with swagger-jsdoc version 6.2.8 but with swagger-ui-express version 4.6.3 and swagger-jsdoc version 6.2.8 it works as expected.

stale[bot] commented 8 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.