Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Stuck at fetching... #24

Closed
angeloh opened this Issue · 6 comments

2 participants

@angeloh

After I executed 'middleman', the UI works fine. However, if I give my local resources.json (http://localhost:9000/resources.json), it stops at 'Fetching _register...' , where register is one of controller.

If I just paste these two links to browser, it returns correct JSON string.
http://localhost:9000/resources.json
http://localhost:9000/register.json

What am I missing on this UI library?

@fehguy
Owner

Hi, can you please use chrome and open the developer tools and let us know what the error message is in the console?

@angeloh

Hi, this is the error messages from chrome developer tool.

Will try the following urls to discover api endpoints: swagger-service.js:27
http://localhost:9000/ swagger-service.js:27
http://localhost:9000 swagger-service.js:27
http://localhost:9000/resources.json swagger-service.js:27
http://localhost:9000/resources swagger-service.js:27
Trying url http://localhost:9000/ swagger-service.js:27
calling url http://bookmarklet.decide.com/bookmarklet/extension?url=http%3A%2F%2Flocalhost%3A4567%2F&callback=_decideBarCallback chrome-extension://nbojbfjmmakegikncmffodghebfbmcem/decide.js:259
XMLHttpRequest cannot load http://localhost:9000/. Origin http://localhost:4567 is not allowed by Access-Control-Allow-Origin.
Trying url http://localhost:9000 swagger-service.js:27
XMLHttpRequest cannot load http://localhost:9000/. Origin http://localhost:4567 is not allowed by Access-Control-Allow-Origin.
Trying url http://localhost:9000/resources.json swagger-service.js:27
Setting globalBasePath to http://localhost swagger-service.js:27
fetchResources: basePath = http://localhost swagger-service.js:27
resourceUrl: "http://localhost/register.json" swagger-service.js:27
Failed to load resource http://localhost/register.json
Failed to load resource: the server responded with a status of 500 (Internal Server Error) http://bookmarklet.decide.com/bookmarklet/extension?url=http%3A%2F%2Flocalhost%3A4567%2F&callback=_decideBarCallback
12event.layerX and event.layerY are broken and deprecated in WebKit. They will be removed from the engine in the near future.
Will try the following urls to discover api endpoints: swagger-service.js:27
http://localhost:9000/resources.json swagger-service.js:27
http://localhost:9000 swagger-service.js:27
http://localhost:9000/resources.json swagger-service.js:27
http://localhost:9000/resources swagger-service.js:27
Trying url http://localhost:9000/resources.json swagger-service.js:27
Setting globalBasePath to http://localhost swagger-service.js:27
fetchResources: basePath = http://localhost swagger-service.js:27
resourceUrl: "http://localhost/register.json" swagger-service.js:27
Failed to load resource

@fehguy
Owner

looks like your base path is set to "http://localhost" but the server is running on port 9000. If you could paste the resources.json and register.json contents here, I think I can point to the issue. And what server framework are you using?

@angeloh

These are the result I get from running Java Play 2 app with swagger.

http://localhost:9000/resources.json

{"apiVersion":"beta","swaggerVersion":"1.0","basePath":"http://localhost","apis":[{"path":"/register.{format}","description":"Operations about register"}]}

http://localhost:9000/register.json

{"apiVersion":"beta","swaggerVersion":"1.0","basePath":"http://localhost","resourcePath":"/register","apis":[{"path":"/register","description":"Operations about register","operations":[{"httpMethod":"POST","summary":"Add a new member to the store","responseClass":"ok","nickname":"registerByForm","parameters":[{"name":"devRegId","description":"device registration id for notification","paramType":"body","required":false,"allowMultiple":false,"dataType":"String"},{"name":"deviceId","description":"device GUID","paramType":"body","required":false,"allowMultiple":false,"dataType":"String"}],"errorResponses":[{"code":405,"reason":"Invalid input"}]}]}]}

@fehguy
Owner

Looks like you need to set your base path in your application conf:

https://github.com/wordnik/swagger-core/blob/master/samples/java-play2/conf/application.conf#L59

It's trying to connect to the basePath of http://localhost but the resource is really on http://locahost:9000

@angeloh

Yes, it works. But it might requires more manual works when deploying to production or staging.

@fehguy fehguy closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.