RuntimeError unable to load module in China mainland

All js files from cdn.jsdelivr.net are failed because cdn.jsdelivr.net has been blocked in China, for details see these issues on GitHub:
#18396 #18397


However, the urls starts with other cdn like https://fastly.jsdelivr.net are still accessible, please consider to replace cdn.jsdelivr.net with other one, or see if this script will be helpful

Hi @Dumpinground, I don’t think that such a change would be feasible.

Luckily there are browser extensions that let you rewrite/redirect requests. One of them is Request Interceptor, which exists both for Chrome and Firefox:

2 Likes

@mootari thank you for your idea.

But It seems not perfect because browser extensions like Request Interceptor are not widely used among the general public, which means it impossible to share these charts with a fresh visitor who has never used Observablehq but need the visual data.

By the way, I used to visit Observablehq with Safari on iOS and share my notebooks with friends who visit those on mobile devices. it is really convient if the cdn server is not blocked. :grinning:

This may be a temporary issue. Another block happened approx. 20 days ago: cdn.jsdelivr.net Partially Censored in China · Issue #18392 · jsdelivr/jsdelivr · GitHub

Even though several commenters suggested that the block would never be lifted, cdn.jsdelivr.net was accessible again about 1-2 days later. Fingers crossed that the DNS cache poisoning will stop again at some point.


To give some background (and please note that I don’t work at Observable): Observable has very limited control of which CDN is used. Packages are fetched from cdn.jsdelivr.net in two cases:

  1. A notebook loads a package by specifying its complete source URL. This is commonly done to avoid additional lookups, and is far more common than you might expect. In this case it’s entirely up to the notebook author.
  2. A notebook loads a package via Observable’s built-in require without specifying the domain from which to load the package. require is actually d3-require, and its default package source is hardcoded to "https://cdn.jsdelivr.net/npm/" (see source). In order to switch to Fastly, Observable would have to include a fork of d3-require, or d3-require would have to release a new version.

With that in mind, let me explain why I don’t think that a switch is feasible:

  1. It would only work for some notebooks.
  2. There’s no guarantee that fastly.jsdelivr.net won’t be blocked as well.
  3. Some companies might apply Firewall rules that explicitely allow cdn.jsdelivr.net, but not fastly.jsdelivr.net. Changing the domain might break their notebooks, and their trust in Observable.

I hope you can see now that such a change would make no one completely happy, but would likely make quite a few people mad.

2 Likes

You are right that we should not change it so casually.

liucsny seems meet with the same problem last year, which shows it is unstable periodically. I wonder if there is a better way to solve it.