CORS issue referencing an externally hosted schema using API Designer


#1

I am getting this error from API Designer when I try and reference an externally hosted schema:

error: cannot fetch http://tas-apps-ref.talentappstore.com/schemas/requisition-schema.json, check that the server is up and that CORS is enabled(HTTP 400)

The error appears as a red cross in the editor.

My RAML file looks like this:

#%RAML 0.8
title: requisitions
version: v1
schemas:

I’ve checked my CORS configuration on my hosted schema and it all seems OK.

I’ve also used a third party site that does CORS testing and it says that CORS is OK for a GET request.

http://client.cors-api.appspot.com/client#?client_method=GET&client_credentials=false&server_url=http%3A%2F%2Ftas-apps-ref.talentappstore.com%2Fschemas%2Frequisition-schema.json&server_enable=true&server_status=200&server_credentials=false&server_tabs=remote

Any idea what this could be?


#2

Hi @abraae,

I’m seeing the same thing in API designer for the schema you shared, but I hit that endpoint with both Postman and curl to take a look and it seems the Access-Control-Allow-Origin header isn’t being returned by the server. Might be worth double checking your CORS configuration.

//Dillon


#3

Wow, thanks for that. I was getting fooled by our office squid proxy as I tried different combinations. Sorry for the confusion.

I’ve fixed my CORS configuration (I believe) and the headers are now definitely appearing when I test with curl (thanks for the tip on that btw).

But API designer still throws the same error.

Any more help appreciated!


#4

Hmm, It’s working for me now - just imported that schema into API designer and it was fine.

#%RAML 0.8
title: someAPI
schemas:
  - requsition: !include http://tas-apps-ref.talentappstore.com/schemas/requisition-schema.json

Inspected the network traffic, and the call is executing fine and the JSON is getting fetched. Maybe try clearing your cache?

Sorry I can’t be more help!


#5

I’ve cleared caches, tried 3 different browsers, two OSs and different network connections, and still I get just the same error. I can’t understand why it would work for you but not me. Really annoying since otherwise API designer looks good for our needs. I’d appreciate knowing your configuration, e.g. browser + os + machine if at all possible.

Thanks for your help anyway, much appreciated.


#6

I’m on OSX 10.7.5 on a MBA, using Chrome Version 36.0.1985.125. I’m using the hosted API Designer at http://api-portal.anypoint.mulesoft.com/raml/api-designer.

Where do you have the API Designer running? Is it your own local version, hosted somewhere, etc?


#7

Aha! I tried to use that portal but new accounts are no longer allowed there. I was directed to instead use:

https://anypoint.mulesoft.com/apiplatform/talent-app-store-ltd/admin/#/dashboard/apis/427/versions/346/designer


#8

Works for me there, too >_<.

Might be worth opening an issue over on the API Designer github so the core contributors from MuleSoft could look into why it’s working for some folks and not others?


#9

Will do, many thanks.