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

Docs.shebang: undefined is not a function #551

Closed
dblock opened this issue Aug 29, 2014 · 21 comments · May be fixed by qsays/swagger-ui#2 or zhouyoufu/swagger-ui#1
Closed

Docs.shebang: undefined is not a function #551

dblock opened this issue Aug 29, 2014 · 21 comments · May be fixed by qsays/swagger-ui#2 or zhouyoufu/swagger-ui#1

Comments

@dblock
Copy link
Contributor

dblock commented Aug 29, 2014

Confirmed that this is a problem with the latest dist, too.

in Docs.shebang, var fragments = $.param.fragment().split('/'); is failing for me, param is a function, and $.param.fragment() is undefined.

I am not sure whether this is a conflict or something else. The entire app is in https://github.com/artsy/doppler and you can see this in https://developers-staging.artsy.net/playground.

@fehguy
Copy link
Contributor

fehguy commented Sep 2, 2014

Hi @dblock , I'd like to sign in to see what is causing the error. If you were to point the petstore version of the swagger ui (http://petstore.swagger.wordnik.com/) to your API, what do you get?

@dblock
Copy link
Contributor Author

dblock commented Sep 2, 2014

Create an account on https://staging.artsy.net and you should see it.

I'll try to repro with petstore soon-ish.

@fehguy
Copy link
Contributor

fehguy commented Sep 2, 2014

Unless I'm doing something wrong, it looks like you've minified the swagger-ui source, and it's pretty hard to debug.

@dblock
Copy link
Contributor Author

dblock commented Sep 2, 2014

You're doing nothing wrong :) If you don't want to wait for me, you can setup https://github.com/artsy/doppler.

  1. Clone https://github.com/artsy/doppler
  2. bundle install
  3. Create an account on https://staging.artsy.net/
  4. Get a key in https://developers-staging.artsy.net/start. You get an app ID and a secret.
  5. Run ARTSY_API_CLIENT_ID=id ARTSY_API_CLIENT_SECRET=secret ARTSY_API_URL=https://stagingapi.artsy.net bin/rails s

You will have it locally, and it's not minified.

@gandarez
Copy link

gandarez commented Sep 5, 2014

Having the same issue here. I'm using the latest version of swagger/swagger-ui. There is a workaround?

@fehguy
Copy link
Contributor

fehguy commented Sep 5, 2014

@dblock @gandarez I simply need more info. For @dblock 's example, swagger-ui was minified, and it's impossible to see if the code is intact. @gandarez if you have your API on a public location, please point us to it. Also, try the vanilla swagger ui from here:

http://petstore.swagger.wordnik.com

@dblock
Copy link
Contributor Author

dblock commented Sep 5, 2014

@fehguy I have a non-minified version for you, http://dblock-doppler.artsy.net, create an account on staging.artsy.net, login via http://dblock-doppler.artsy.net and click "Playground".

@gandarez
Copy link

gandarez commented Sep 5, 2014

Hi folks,

If you are using Web Api or MVC (Microsoft) you could review your Bundle configuration file. At the beginning of the file you must add 3 new commands wich will clean and reset all previous bundles that have added.
I've figured out that jquery.ba-bbq.min.js have not been included in rendered html.

image

@dblock
Copy link
Contributor Author

dblock commented Sep 5, 2014

If I am not mistaken @gandarez issue was different, in my case ba-bbq is def. included.

@Tug
Copy link

Tug commented Sep 15, 2014

I had this issue when jQuery was included twice in the page.
Check that it is not the case for you ;)

@gandarez
Copy link

I have only one jquery included by page.

@fehguy
Copy link
Contributor

fehguy commented Sep 15, 2014

@dblock I'm having trouble signing into the site to try this. Is it operational? Maybe some known credentials that I can use?

@dblock
Copy link
Contributor Author

dblock commented Sep 15, 2014

@fehguy This will be alive for another maybe 24 hours, I'd have to redo it then. Feel free to find me via email, dblock at dblock dot org if you need the account again.

Username: [email protected]
Password: password

@fehguy
Copy link
Contributor

fehguy commented Sep 15, 2014

@dblock I think the error is because it's taking so long to load your swagger resources. I think the timeout to expand the shebang is to low for the speed of the json being served.

image

@dblock
Copy link
Contributor Author

dblock commented Sep 15, 2014

How do we fix this? This should work reliably though even if it takes forever, no? Generally I would want a callback on when things are "done", had some other issue trying to remove a message when all the API info was downloaded, see #550.

@fehguy
Copy link
Contributor

fehguy commented Sep 15, 2014

yes, it should. tracing the calls, it actually looks like you have multiple jquery libraries loading:

<script src="/assets/jquery.js?body=1"></script>
  • jQuery JavaScript Library v1.11.1

and

<script src="/assets/lib/jquery-1.8.0.min.js?body=1"></script>

I'm guessing this is a culprit in causing the issue as well.

@dblock
Copy link
Contributor Author

dblock commented Sep 15, 2014

The multiple JQuery library problem is interesting - especially with all packaged solutions like https://github.com/BrandyMint/grape-swagger-rails, opened https://github.com/BrandyMint/grape-swagger-rails/issues/36 for your comments.

@fehguy
Copy link
Contributor

fehguy commented Sep 15, 2014

When I load in the standard swagger-ui, it works like a champ, and waits for your resources to load before expanding anything. Not to pass the buck, but I think it's probably specific to the libs that you're loading.

image

@dblock
Copy link
Contributor Author

dblock commented Sep 16, 2014

I found the problem. Thanks for your helpful suggestions.

First, I was including JQuery twice, once from my main Rails application.js and second via swagger-ui. I removed the swagger's version.

Second, jquery-bbq defines $.param.fragment, however it needs to be included after JQuery. In my app JQuery was re-included a second time, removing that definition, causing the shebang function not to be able to do $.param.fragment.

If you want to see a diff of the fix, artsy/doppler#42.

@dblock dblock closed this as completed Sep 16, 2014
@fehguy
Copy link
Contributor

fehguy commented Sep 16, 2014

hey @dblock thanks for following up with this.

@javabrett
Copy link
Contributor

I had this issue when jQuery was included twice in the page.

This happened to me when trying to use Tampermonkey with Swagger UI, with a script which did // @require http://code.jquery.com/jquery..., resulting in two copies of jQuery being loaded. Removing the @require fixes that.

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