Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Fallback for CDN libs #11

Closed
jimr opened this issue Aug 16, 2017 · 7 comments
Closed

Fallback for CDN libs #11

jimr opened this issue Aug 16, 2017 · 7 comments

Comments

@jimr
Copy link

jimr commented Aug 16, 2017

$ curl -I https://unpkg.com/react@15.4.2/dist/react.min.js
HTTP/1.1 404 Not Found
Date: Wed, 16 Aug 2017 08:53:46 GMT

The versions hosted on CDNJS seem fine:

$ curl -I https://cdnjs.cloudflare.com/ajax/libs/react/15.4.2/react.min.js
HTTP/1.1 200 OK
Date: Wed, 16 Aug 2017 08:55:22 GMT

Maybe it's a good idea to do a HEAD request on the CDN libs at app initialization & fall back to an alternate CDN or local versions of the files if they're not found?

@MartinKolarik
Copy link

Lots of people have been complaining about random 404 and 503 unpkg responses recently. You can always use jsDelivr instead, which works in a similar way but is more reliable: https://cdn.jsdelivr.net/npm/react@15.4.2/dist/react.min.js

@radumas
Copy link

radumas commented Aug 16, 2017

Solution from ☝️ works on heroku as well:

app.css.config.serve_locally = True
app.scripts.config.serve_locally = True

@chriddyp
Copy link
Member

Yeah, a fallback seems like a good idea.

@chriddyp chriddyp changed the title CDN libs missing Fallback for CDN libs Aug 18, 2017
@chriddyp
Copy link
Member

chriddyp commented Dec 6, 2017

Some users reporting another issue with unpkg this morning. This is the 3rd time that we've had issues with this particular CDN since July.
Other CDN options:

However, the issues have not lasted for a long time, so perhaps just a simple fallback to local would suffice for now.

@MartinKolarik
Copy link

@chriddyp switching to jsDelivr is definitely a good idea, we built it specifically for production usage with multiple failover levels (unpkg wasn't built to be used in production although some people started using it as such).

I'd also advise against rolling your own solution with S3 - it most likely wouldn't be more reliable than unpkg.

@jtpio
Copy link

jtpio commented Dec 7, 2017

However, the issues have not lasted for a long time, so perhaps just a simple fallback to local would suffice for now

We experienced the issue for more than 12 hours before rolling out a fix as mentioned in the forum:
https://community.plot.ly/t/dash-renderer-0-11-1-dash-renderer-bundle-js/7179/16

If unpkg was never meant to be used in production, I would also go for a different default CDN like cdnjs or cdn.jsdelivr.

@alexcjohnson
Copy link
Collaborator

Closing as we merge this repo with the main dash repo. Anyway in dash 1.0 the default will change to serve_locally=True plotly/dash#722

I have no strong feelings about any of the CDNs mentioned here vs unpkg, but if anyone would like to make a clear case for a different one - and accompany it with a PR to the main repo after the dash+renderer merge - we'd be be more than happy to switch!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants