I am sometimes getting a “could not resolve” error with the notebook
Refreshing the page and clearing cache sometimes helps. I also have this fork of the notebook that does not have the same issue
The notebook makes several GET requests from different resources (Biorxive, GitHub, Google sheets), computes a word cloud, and renders a table.
Hi @cornhundred,
I’m not seeing a “could not resolve” error when viewing the first notebook. Can you share a screenshot of the error and/or the cell in which it occurs the next time it happens again?
Thanks @jashkenas, I attached a screenshot of the error (which only happen somtimes):
Here’s the error message that appears CORS related:
Access to fetch at 'https://docs.google.com/spreadsheets/d/e/2PACX-1vRngfhDKqZUEhHuQY60n3Bh76gkMQKeOq6D7UYkSgt0KPP7rcCTE-PjMeWO1g1YlGVhBTAMJS6rn-pc/pub?gid=0&single=true&output=tsv' from origin 'https://ismms-himc.static.observableusercontent.com' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'https://cornhundred.static.observableusercontent.com' that is not equal to the supplied origin. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
In other parts of the notebook I’m using https://cors-anywhere.herokuapp.com/
to get around non-CORs supported APIs. So I added it to the get request for the google sheet in the latest version using the variable any_cors_url
. I’ll see if this fixes things.
Sounds like you got it sorted out. For what it’s worth, CORS Anywhere’s demo instance is pretty heavily rate limited — so using that itself may cause your notebook to only load intermittently, as it rate-limits your proxy requests.
Great, thanks for the help. Do you know of any alternatives to cors-anywhere (other than asking people to allow CORS). For my purposes it seems to be working alright.
I don’t know of any good open alternatives. Asking people to fix their sites to allow CORS is the best … and failing that, running your own version of CORS-anywhere for your own purposes.
We’ve thought in the past about operating an Observable-hosted CORS proxy for notebooks to use to connect to public data endpoints that haven’t adopted CORS yet. I’ll take this issue as another positive vote for that old idea…
4 Likes