Getting "Can't read from file" error on online.swagger.io
{
"schemaValidationMessages": [{
"level": "error",
"message": "Can't read from file https://api.npr.org/documentation/beryllium/swagger.json"
}]
}
https://api.npr.org/documentation/beryllium/swagger.json is accessible to the public, and I know that the validator used to work at least as of March 1st, when I last did some maintenance on our Swagger instance. (I opened a ticket in our system to follow up with some more maintenance for a future date, which is how I know when it was last confirmed working.) So sometime between then & today, the validator stopped working.
Any ideas?
Hi, looks like this is caused because your server is taking a long time to respond:
$ time curl https://api.npr.org/documentation/beryllium/swagger.json > /dev/null
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 117k 0 117k 0 0 14909 0 --:--:-- 0:00:08 --:--:-- 33264
real 0m8.063s
user 0m0.023s
sys 0m0.011s
We actually recently set the timeout on the validator badge to 2 seconds for both connect & read to avoid load issues. I can increase the read timeout but the connect timeout needs to be short.
Any chance you can add a cache on your side?
Hmm, I see. I thought we had some caching on our side, but it looks like the Cache-Control header is messed up. I'll have to dig into our Apache settings.
Thanks!
I will improve the error message and increase the read timeout. Connect timeout will stay at 2 sec though.