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

Swagger UI not able to load #3089

Closed
kyyberi opened this issue Nov 2, 2017 · 21 comments
Closed

Swagger UI not able to load #3089

kyyberi opened this issue Nov 2, 2017 · 21 comments
Assignees
Labels

Comments

@kyyberi
Copy link

kyyberi commented Nov 2, 2017

Steps to Reproduce:

  1. go to page: https://apinf.io/apis/kunta-api
  2. Click documentation tab

Outcome:

screenshot at marraskuuta 02 09-06-16

Expected Behavior:

Load SwaggerUI

Environment:

Mac 10.12.6 , Chrome browser (l61.0.3163.100), APInf production site (https://apinf.io)

@kyyberi kyyberi added the bug label Nov 2, 2017
@Nazarah
Copy link
Contributor

Nazarah commented Nov 2, 2017

Tested in Windows 8 with Chrome (latest version) browser and was able to reproduce it.
Found the following violation messages in the console view
swaggeruiload

@kyyberi
Copy link
Author

kyyberi commented Nov 2, 2017

Swagger seems to be valid, but....
screenshot at marraskuuta 02 10-16-33

@kyyberi
Copy link
Author

kyyberi commented Nov 2, 2017

@marla-singer
Copy link
Contributor

@kyyberi I fixedit via UI. Don't know what happened but I've got e-mail notification about error on the server side

SyntaxError: Error parsing "https://github.com/Metatavu/kunta-api-spec/blob/master/swagger.yaml" 
end of the stream or a document separator is expected at line 313, column 24:
      <!-- blob contrib key: blob_contributors:v21:d22dbc1c

and

RangeError: Maximum call stack size exceeded

Looks like the Swagger didn't parse the file and fall down with stack overflow

@kyyberi
Copy link
Author

kyyberi commented Nov 2, 2017

I'm not able to get it to load.

@kyyberi
Copy link
Author

kyyberi commented Nov 7, 2017

Problem still exists. This API is going to real use soon in one of our Smart city cases.

@55
Copy link
Contributor

55 commented Nov 7, 2017

Same thing locally.
I tried via

  • file upload
  • URL
  • conversion to JSON

Also getting in console:

raven@2.2.1 alert: unhandledRejection captured: 9e46c6e3f0464545b27ee3f5ad607068
raven@2.2.1 alert: unhandledRejection captured: de552699f6b849b7970ba00e38bb01e2
raven@2.2.1 alert: unhandledRejection captured: bb343e3441c843e2adc47aa471308957
raven@2.2.1 alert: unhandledRejection captured: 849e464fc1cf4edfbec7ab468e6ac4e2
raven@2.2.1 alert: unhandledRejection captured: e88479a4a7b84a77a7162d69718ea987

@55
Copy link
Contributor

55 commented Nov 8, 2017

Used URL https://raw.githubusercontent.com/Metatavu/kunta-api-spec/master/swagger.yaml @ http://petstore.swagger.io/. Perfectly works.

@kyyberi
Copy link
Author

kyyberi commented Nov 8, 2017

@55 that was the message from client as well.

@krashna-deligence
Copy link
Contributor

Hi @55 i have checked this issue on "Google Chrome" and "mozilla" and i did't get this type of error . Please review below gifs
firfox
chrome

@marla-singer
Copy link
Contributor

marla-singer commented Nov 30, 2017

@kyyberi @55 It was link to the incorrect Swagger file with "circular references". The Swagger couldn't build the correct UI.

I went through entire file and resolved the circular references directly.

@55
Copy link
Contributor

55 commented Nov 30, 2017

@marla-singer any ideas why it worked at http://petstore.swagger.io?

@marla-singer
Copy link
Contributor

@55 Nope. It needs detailed investigation

@55
Copy link
Contributor

55 commented Nov 30, 2017

@krashna-deligence interesting, what OS were you using?

@krashna-deligence
Copy link
Contributor

ubantu 16.04

@marla-singer
Copy link
Contributor

Investigation report

I thought the problem comes from library "swagger-parser":

  1. I upgraded the library "swagger-parser" to v4.0.0 and I've got the same result
  2. I went through the source code of library and didn't find any problem with a circular reference.
  3. README.md says:

Supports circular references, nested references, back-references, and cross-references

  1. Anyway, the swagger-parser returns the correct result but the client side doesn't receive it.

The error trace displays that the problem comes from EJSON
joxi_screenshot_1512570346016 1

I tried to catch the error with "Maximum call stack size exceeded" but no success. The circular reference is the invalid type of JSON and EJSON can't work as expected.

Didn't think up any good idea about how to fix it or notice a user about this error

@krashna-deligence krashna-deligence removed their assignment Dec 8, 2017
@Nazarah
Copy link
Contributor

Nazarah commented Dec 12, 2017

Tested in https://staging.apinf.io (release 0.52). The problem exists there with APIs having swagger documentation. screenshot of the exception caught is attached.

Exception
image

documentationtabload

cc @saransh-dev

@saransh-dev
Copy link
Contributor

Yes, we need to check result also in onCreated at line number 33 inside apinf_packages/api_docs/swagger_ui/swagger_ui.js
Currently we have like if (result.schemes && result.schemes[0] === 'http') { and we need to make it like if (result && result.schemes && result.schemes[0] === 'http') {

@preriasusi preriasusi assigned preriasusi and anarva and unassigned preriasusi Dec 12, 2017
@anarva anarva assigned preriasusi and unassigned anarva Dec 14, 2017
@anarva
Copy link
Contributor

anarva commented Dec 14, 2017

@preriasusi - I cannot reproduce this on apinf.io, which is where the original error was first found. The later comments on this bug report are referring to another bug which was reported and fixed in another report. Please check, and if you agree, close this issue.

@kyyberi
Copy link
Author

kyyberi commented Dec 14, 2017

In apinf.io kunta-api seems to load swagger
kunta-api

@anarva
Copy link
Contributor

anarva commented Dec 14, 2017

Thanks, closing..

@anarva anarva closed this as completed Dec 14, 2017
@ghost ghost removed the ready label Dec 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants