Skip to content
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

Sourcemap does not work #9101

Closed
CidTori opened this issue Jul 31, 2023 · 8 comments
Closed

Sourcemap does not work #9101

CidTori opened this issue Jul 31, 2023 · 8 comments

Comments

@CidTori
Copy link

CidTori commented Jul 31, 2023

Q&A (please complete the following information)

Content & configuration

Go to https://petstore3.swagger.io/

Describe the bug you're encountering

Sourcemaps in the DevTools does not work

To reproduce...

Steps to reproduce the behavior:

  1. Go to https://petstore3.swagger.io/
  2. Open dev tools
  3. Go to the Sources tab
  4. Open top > SwaggerUIBundle > src > index.js
  5. Instead of the sources you see the following error: "Could not load content for webpack://SwaggerUIBundle/src/index.js (Fetch through target failed: Unsupported URL scheme; Fallback: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME)"

Expected behavior

The original sources should be displayed

@char0n
Copy link
Member

char0n commented Aug 2, 2023

Hi @CidTori,

Would you consider investigating and issuing a fixing PR?

@char0n
Copy link
Member

char0n commented Aug 21, 2023

Standalone preset source map looks to be corrupted as well.

@ljerka
Copy link

ljerka commented Sep 14, 2023

@CidTori Today I stumbled upon the same error (Could not load content for webpack://SwaggerUIBundle/src/index.js (Fetch through target failed: Unsupported URL scheme; Fallback: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME).

Chrome v113 and Edge displayed the error, Firefox 113 was without error.
In my case, swagger was running on OpenShift, on Node v14. Upgrading to Node v18 solved the problem.

@justin-obn
Copy link

Any update on this?

@hamzasial1911
Copy link

@CidTori I am assuming that you are passing the JSON file to your swagger and that you are also giving the host in the JSON file. Try removing the host if you are running it locally.

assuming:

{
    "swagger": "2.0",
    "info": {
      "title": "API Documentation",
      "version": "1.0.0"
    },
    "schemes": [
      "http",
      "https"
    ],
   "host": '127.0.0.1:3000' //remove the host
}

expected:

{
    "swagger": "2.0",
    "info": {
      "title": "API Documentation",
      "version": "1.0.0"
    },
    "schemes": [
      "http",
      "https"
    ]
}

@CidTori
Copy link
Author

CidTori commented Mar 19, 2024

I'm not passing anything, I'm just opening https://petstore3.swagger.io/ on my browser, it's swagger.io's demo swagger-ui, I don't own it.

@CidTori
Copy link
Author

CidTori commented Mar 19, 2024

Hi @CidTori,

Would you consider investigating and issuing a fixing PR?

I'd like to, but I won't be able to do it anytime soon, sorry 😕

@glowcloud
Copy link
Contributor

The error was addressed in #9877.

We decided that the source maps will only be available for browser environment builds, so that it's possible for them to be debugged in development: #9877 (comment)
As such, we'll provide source maps for browser exports, which can be seen here:

swagger-ui/package.json

Lines 6 to 24 in 8c90d5d

"exports": {
"./dist/swagger-ui.css": "./dist/swagger-ui.css",
"./dist/oauth2-redirect.html": "./dist/oauth2-redirect.html",
"./dist/swagger-ui-standalone-preset": "./dist/swagger-ui-standalone-preset.js",
".": {
"browser": {
"import": "./dist/swagger-ui-es-bundle-core.js",
"require": "./dist/swagger-ui.js"
},
"node": {
"import": "./dist/swagger-ui-bundle.js",
"require": "./dist/swagger-ui-es-bundle.js"
},
"default": {
"import": "./dist/swagger-ui-bundle.js",
"require": "./dist/swagger-ui-es-bundle.js"
}
}
},

This means that the source maps won't be available for SwaggerUIBundle anymore, which was the original error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants