Request Entity Too Large: Can't save large Jupyter notebook, despite configuring max_body_size

Viewed 2493

I have a JupyterLab notebook that throws the error below when I try to save it.

File Save Error for ld_matrix.ipynb
Invalid response: 413 Request Entity Too Large

The notebook contains an image plot (via Bokeh image plot), which is about 200 KB (so, not very large).

I tried increasing c.NotebookApp.max_body_size (see Jupyter config docs) in the Jupyter config, but this didn't help. I also tried c.NotebookApp.max_buffer_size to also to no avail.

Jupyter versions:

jupyter core     : 4.7.0
jupyter-notebook : 6.1.5
jupyter client   : 6.1.7
jupyter lab      : 2.2.9
1 Answers

Sorry, I have only a (potential) partial workaround. I get the same issue when I try to connect to my server using localtunnel but when I do ssh port forwarding, I do not get the issue.

My jupyter --version gives the following:

jupyter core     : 4.6.3
jupyter-notebook : 6.1.4
qtconsole        : 4.7.7
ipython          : 7.19.0
ipykernel        : 5.3.4
jupyter client   : 6.1.7
jupyter lab      : 2.2.6
nbconvert        : 6.0.7
ipywidgets       : 7.5.1
nbformat         : 5.0.8
traitlets        : 5.0.5

I launch the notebook with

nohup jupyter notebook --no-browser --port=8889

I launch the ssh port forwarding with

ssh -L 8889:127.0.0.1:8889 user@example.com

Here user@example.com is my account on the remote server I have access to and on which I wish to run the notebook server.

I then access the notebooks over my local machine's browser by going to localhost:8889. They can be edited and autosave correctly.

To access the notebooks using localtunnel I call

nohup npx localtunnel --port 8889 --subdomain mysubdomain

And then try to access the notebook with mysubdomain.loca.lt. When I save the notebook I get a brown box appearing in the top right that says "Request Entity Too Large." Sometimes when I clear all output I can save but not always. I indeed changed the two settings you changed (and indeed my notebook was below the old limits) and this did not help. To ensure these parameters were indeed being set I also tried modifying my command launching the notebook server:

nohup jupyter notebook --no-browser --port=8889 --NotebookApp.max_buffer_size=numberofbytes --NotebookApp.max_body_size=numberofbytes

I do not why a SSH tunnel magically fixes the issue for me! Ideally I would let other people edit my notebooks with only the notebook password, not my account password for my account on the remote server, hence my desire to use a service like localtunnel.

Related