Open sbrunk opened 5 years ago
hey
no need to use your repo, the one that we have on binder:
https://rise.readthedocs.io/en/stable/resources.html#github-readthedocs-gitter-youtube
exhibits that issue all right, see examples/README
this being said I cannot be 100% positive that this has worked perfectly in the past, given that the failure can easily go unnoticed - in our case at least (this is because the README on purpose uses a theme very close to the default)
so yes, this clearly has to do with jupyterhub acting less transparently than when running off a local disk; I'm not quite sure how to handle that properly
on the one hand, the way we search for custom css is questionable; and as result, among other things, the error messages that show up in the console are confusing, because the custom files are only optional so their absence should not trigger an error
on the other hand, I am not aware of a mechanism - api or other - that would let us do something equivalent; our requirements would to keep it as simple (i.e. staying away from jupyter abstruse config system), in a less confusing way (no more red herring), and that would be guaranteed to work in a hosted environment like jupyterhub
if such a mechanism was available rise would clearly benefit from using it :)
in the meanwhile, it's be interesting to ask jupyterhub on their thoughts about that behaviour
Let's ping some JupyterHub/Binder devs here, maybe they have some quick feedback for us.
cc @minrk @choldgraf @betatim
Who/how is the request for https://hub.gke.mybinder.org/hub/files/examples/rise.css
generated? It looks like who ever is doing that generates an absolute URL instead of a relative one (and assumes that /hub/
is a good starting value).
If possible you need to generate a URL relative to the notebook or do some (very clever) stuff looking at the URL you are being served from to figure out what the absolute URL should be.
Thanks @parmentelat for the explanations.
For anyone running into this until we have a proper fix, here's the workaround I used for publishing my slides on binder:
i.e. in postBuild
JUPYTER_CONFIG_DIR=$(jupyter --config-dir)
mkdir $JUPYTER_CONFIG_DIR/custom
cp rise.css $JUPYTER_CONFIG_DIR/custom/custom.css
@betatim this seems to be the code generating the link.
I'd say the leading /
in line 493 is what is causing the problem. That needs to be a relative path or you need to put a prefix in front of the prefix. I have no idea which of these options is easier/possible though.
Thanks @betatim for your feedback!
Btw, two PR implemented different solutions: #482 (merged) and #487 (interesting alternative). Some discussions happening on the latest one now.
I'm trying to publish RISE enabled runnable slides via binder, and I'm running into an issue with custom css. Seems like it tries to load rise.css from the wrong location (https://hub.gke.mybinder.org/hub/files/examples/rise.css) and gets a 404.
I'm not sure if this is really an issue with RISE or rather caused by binder/jupyterhub because its working perfectly when running a jupyter server locally.
You should be able to reproduce and see the issue by running the binder example in this repo and looking into the browser dev tools.