jupyterhub / binderhub

Run your code in the cloud, with technology so advanced, it feels like magic!
https://binderhub.readthedocs.io
BSD 3-Clause "New" or "Revised" License
2.54k stars 388 forks source link

`Dockerfile` based repositories fail to start up, citing "Error unpacking user from cookie" #1622

Open wallyhall opened 1 year ago

wallyhall commented 1 year ago

Bug description

Building from a repo with a Dockerfile (so this may be a repo2docker issue, but I don't understand it enough to know where to raise this other than here) fails to start due to "invalid/expired cookie" when "handing over" to JupyterLab/Notebook in browser.

Example on mybinder.org: https://mybinder.org/v2/gh/binder-examples/minimal-dockerfile/HEAD

I've reproduced the issue on 1.0.0-0.dev.git.2937.h0f65f33 locally too, using our own Dockerfile.

Logs from the "spun up" container created by repo2docker (and orchestrated by Binder):

[W 16:12:41.062 NotebookApp] Not allowing login redirect to '/user/evonetix-xxx-nt805vjb/lab/?'
[I 16:12:41.065 NotebookApp] 302 POST /user/evonetix-xxx-nt805vjb/login?next=%2Fuser%2Fevonetix-xxx-nt805vjb%2Flab%2F%3F (::ffff:10.100.100.120) 4.270000ms
[I 16:12:41.088 NotebookApp] 302 GET /user/evonetix-xxx-nt805vjb/ (::ffff:****) 0.830000ms
[E 16:12:41.111 NotebookApp] Error unpacking user from cookie: Expecting value: line 1 column 1 (char 0)
[W 16:12:41.112 NotebookApp] Clearing invalid/expired login cookie username-hub-binder-evonetix-net
[I 16:12:41.115 NotebookApp] 302 GET /user/evonetix-xxx-nt805vjb/lab/? (::ffff:****) 4.620000ms

On mybinder.org you get a pretty error message. On ours locally, we get the Jupyter "login" screen, asking for a token.

Providing the token (as extracted from kubectl describe pod ...) just bumps back to the same screen with no error. The logs contain the above.

Expected behaviour

We expect the Jupyter notebook to appear!

Actual behaviour

We get a Jupyter login page asking for the token again (with no error) ... or an error page on mybinder.org.

How to reproduce

Try to start a repo with a Dockerfile, for example: https://mybinder.org/v2/gh/binder-examples/minimal-dockerfile/HEAD

We've tried our own Dockerfile too, carefully following the Binder documentation on the subject.

Have tried specifying JupyterLab 3.4.8 in via our requirements.txt explicitly too, in case it was an incompatibility with newer versions. Same problem persists.

wallyhall commented 1 year ago

I've been informed from a colleague that the mybinder.org example "sometimes possibly works" ... at least, that's as much as we can tell. YMMV doing it on mybinder.org.

Screenshot of what I see:

image

wallyhall commented 1 year ago

I'm not going to close this ticket - I'll leave that up to the maintainers.

We were able to fix the issue by pinning to a specific version of JupyterLab: jupyterlab==3.4.8.

It looks like a regression or new incompatibility between Binder[Hub]/repo2docker etc and the latest JupyterLab?

Hopefully that's useful information to someone else!

jcrist commented 1 year ago

I ran into this issue as well, and can confirm that pinning to jupyterlab==3.4.8 resolves the issue. Thanks for posting your findings here, been banging my head against this for a while :).