REST API not connecting due to CORS

I’m trying to setup the Countries API example in appgyver academy. I’m getting the following error during the Get Collection (GET) Test in the Data Configurator…

Error: TypeError: Failed to fetch. Does the server allow CORS?status: undefined

Resource settings for Get collection (GET)

Resource URL: https://www.countries.eu/rest/v2
Relative path: undefined

Console:
26 Sep 14:11:05 - [info] nodes.flows.started-flows
VM14:1 GET https://www.countries.eu/rest/v2 net::ERR_CONNECTION_TIMED_OUT
(anonymous) @ VM14:1
(anonymous) @ raven.js:1619
makeRequest @ VM705:209
eval @ VM705:230
eval @ VM705:297
Script.runInCleanerContext @ node-red-runtime-1be23d5d38806b5eeb90c6f0ca5331da17adef48faf5451099b0be29a34a3e04.js:3621
(anonymous) @ node-red-runtime-1be23d5d38806b5eeb90c6f0ca5331da17adef48faf5451099b0be29a34a3e04.js:115146
emit @ node-red-runtime-1be23d5d38806b5eeb90c6f0ca5331da17adef48faf5451099b0be29a34a3e04.js:51602
Node.receive @ node-red-runtime-1be23d5d38806b5eeb90c6f0ca5331da17adef48faf5451099b0be29a34a3e04.js:108696
Node.send @ node-red-runtime-1be23d5d38806b5eeb90c6f0ca5331da17adef48faf5451099b0be29a34a3e04.js:108588
(anonymous) @ node-red-runtime-1be23d5d38806b5eeb90c6f0ca5331da17adef48faf5451099b0be29a34a3e04.js:109656
emit @ node-red-runtime-1be23d5d38806b5eeb90c6f0ca5331da17adef48faf5451099b0be29a34a3e04.js:51602
emit @ node-red-runtime-1be23d5d38806b5eeb90c6f0ca5331da17adef48faf5451099b0be29a34a3e04.js:3930
execFlow @ logic_runtime_utils.js:24
(anonymous) @ global_data_menu_directive.js:210
Promise.then (async)
f.testOperation @ global_data_menu_directive.js:208
fn @ VM496:4
expensiveCheckFn @ interface_builder-60be243d47c6b91c507f7f66b5c476d8ef29e60905fcb704f933ad8300c86adc.js:62917
callback @ interface_builder-60be243d47c6b91c507f7f66b5c476d8ef29e60905fcb704f933ad8300c86adc.js:73296
$eval @ interface_builder-60be243d47c6b91c507f7f66b5c476d8ef29e60905fcb704f933ad8300c86adc.js:64698
$apply @ interface_builder-60be243d47c6b91c507f7f66b5c476d8ef29e60905fcb704f933ad8300c86adc.js:64798
(anonymous) @ interface_builder-60be243d47c6b91c507f7f66b5c476d8ef29e60905fcb704f933ad8300c86adc.js:73301
dispatch @ interface_builder-60be243d47c6b91c507f7f66b5c476d8ef29e60905fcb704f933ad8300c86adc.js:4444
elemData.handle @ interface_builder-60be243d47c6b91c507f7f66b5c476d8ef29e60905fcb704f933ad8300c86adc.js:4130
d @ raven.js:521
raven.js:135 in errorNode {supersonic: Proxy, _nodeOutputValues: {…}, debugger_subflow_input_arguments: {…}, testSuccess: ƒ, testFailure: ƒ, …}
a. @ raven.js:135
eval @ VM706:4
eval @ VM706:5
Script.runInContext @ node-red-runtime-1be23d5d38806b5eeb90c6f0ca5331da17adef48faf5451099b0be29a34a3e04.js:3604
(anonymous) @ node-red-runtime-1be23d5d38806b5eeb90c6f0ca5331da17adef48faf5451099b0be29a34a3e04.js:115422
emit @ node-red-runtime-1be23d5d38806b5eeb90c6f0ca5331da17adef48faf5451099b0be29a34a3e04.js:51602
Node.receive @ node-red-runtime-1be23d5d38806b5eeb90c6f0ca5331da17adef48faf5451099b0be29a34a3e04.js:108696
Node.send @ node-red-runtime-1be23d5d38806b5eeb90c6f0ca5331da17adef48faf5451099b0be29a34a3e04.js:108653
(anonymous) @ node-red-runtime-1be23d5d38806b5eeb90c6f0ca5331da17adef48faf5451099b0be29a34a3e04.js:116174
emit @ node-red-runtime-1be23d5d38806b5eeb90c6f0ca5331da17adef48faf5451099b0be29a34a3e04.js:51602
Node.receive @ node-red-runtime-1be23d5d38806b5eeb90c6f0ca5331da17adef48faf5451099b0be29a34a3e04.js:108696
Node.send @ node-red-runtime-1be23d5d38806b5eeb90c6f0ca5331da17adef48faf5451099b0be29a34a3e04.js:108653
sendResults @ node-red-runtime-1be23d5d38806b5eeb90c6f0ca5331da17adef48faf5451099b0be29a34a3e04.js:115056
(anonymous) @ node-red-runtime-1be23d5d38806b5eeb90c6f0ca5331da17adef48faf5451099b0be29a34a3e04.js:115171
Promise.then (async)
(anonymous) @ node-red-runtime-1be23d5d38806b5eeb90c6f0ca5331da17adef48faf5451099b0be29a34a3e04.js:115146
emit @ node-red-runtime-1be23d5d38806b5eeb90c6f0ca5331da17adef48faf5451099b0be29a34a3e04.js:51602
Node.receive @ node-red-runtime-1be23d5d38806b5eeb90c6f0ca5331da17adef48faf5451099b0be29a34a3e04.js:108696
Node.send @ node-red-runtime-1be23d5d38806b5eeb90c6f0ca5331da17adef48faf5451099b0be29a34a3e04.js:108588
(anonymous) @ node-red-runtime-1be23d5d38806b5eeb90c6f0ca5331da17adef48faf5451099b0be29a34a3e04.js:109656
emit @ node-red-runtime-1be23d5d38806b5eeb90c6f0ca5331da17adef48faf5451099b0be29a34a3e04.js:51602
emit @ node-red-runtime-1be23d5d38806b5eeb90c6f0ca5331da17adef48faf5451099b0be29a34a3e04.js:3930
execFlow @ logic_runtime_utils.js:24
(anonymous) @ global_data_menu_directive.js:210
Promise.then (async)
f.testOperation @ global_data_menu_directive.js:208
fn @ VM496:4
expensiveCheckFn @ interface_builder-60be243d47c6b91c507f7f66b5c476d8ef29e60905fcb704f933ad8300c86adc.js:62917
callback @ interface_builder-60be243d47c6b91c507f7f66b5c476d8ef29e60905fcb704f933ad8300c86adc.js:73296
$eval @ interface_builder-60be243d47c6b91c507f7f66b5c476d8ef29e60905fcb704f933ad8300c86adc.js:64698
$apply @ interface_builder-60be243d47c6b91c507f7f66b5c476d8ef29e60905fcb704f933ad8300c86adc.js:64798
(anonymous) @ interface_builder-60be243d47c6b91c507f7f66b5c476d8ef29e60905fcb704f933ad8300c86adc.js:73301
dispatch @ interface_builder-60be243d47c6b91c507f7f66b5c476d8ef29e60905fcb704f933ad8300c86adc.js:4444
elemData.handle @ interface_builder-60be243d47c6b91c507f7f66b5c476d8ef29e60905fcb704f933ad8300c86adc.js:4130
d @ raven.js:521
raven.js:135

Any ideas?
Thanks!

Hey man, are you need specificaly countries API or is it just in terms of learning?

It seems like the website is down and that’s why you are getting timeout. (If something like this happens it’s always good to open the API url and check documentations that you’ve set up connection correctly)

If you are looking for a way, how to learn using API and don’t need countries per se, you can try other “test” APIs ie POKE API (https://pokeapi.co/)

I went back to the docs/video and had to tweak a setting. Works great now! Thanks!