Open m0x61h0x64i opened 10 months ago
Can we enable swagger UI in HTTP also
Facing same issue as @m0x61h0x64i.
Fixed this issue with a workaround. Changes made in esbuild.config.js.
const { build } = require('esbuild');
const { copy } = require('esbuild-plugin-copy');
build({
entryPoints: ['index.ts'],
outdir: 'build', // destination folder
sourcemap: 'inline',
platform: 'node',
bundle: true,
plugins: [
copy({
assets: [
{
from: ['./node_modules/swagger-ui-dist/swagger-ui-bundle.js'],
to: 'build/SwaggerUIBundle.js', // in destination folder
},
{
from: [
'./node_modules/swagger-ui-dist/swagger-ui-standalone-preset.js',
],
to: 'build/SwaggerUIStandalonePreset.js', // in destination folder
},
],
}),
],
}).catch(() => process.exit(1)); // Exit with an error code on build failure
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 :
I have tried disabling all routes, cause i have written new routes and docs, but that didnt help.
now this is my localhost :![image](https://github.com/scottie1984/swagger-ui-express/assets/109550653/26607df6-28c0-4bf6-8621-4c2e4cbc7a58)
and this is my production swagger :![image](https://github.com/scottie1984/swagger-ui-express/assets/109550653/c30aff09-bd85-4c49-99da-800082584cb0)
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.