jupyterlab / jupyterlab-git

A Git extension for JupyterLab
BSD 3-Clause "New" or "Revised" License
1.46k stars 319 forks source link

get 404 with jupyterlab behind nginx #1234

Open cjbd opened 1 year ago

cjbd commented 1 year ago

Description

Hello, I follow this article to put my jupyterlab behind nginx, it's working fine

But when I install jupyterlab-git extension with pip, I always get this error message in the front end: image

and from the console output, I can see error log like this:

[W 2023-03-20 03:38:17.634 ServerApp] 404 GET /git/settings?version=0.41.0&1679283497734 
(172.18.0.1) 0.81ms

Reproduce

  1. pip install jupyterlab-git
  2. reload jupyterlab
  3. check error message in both front end and back end

Expected behavior

jupyterlab-git extension should work like without nginx

Context

"@jupyter-server/resource-usage@0.7.2" is not compatible with the current JupyterLab Conflicting Dependencies: JupyterLab Extension Package

=3.4.4 <3.5.0 >=3.5.1 <4.0.0 @jupyterlab/application =3.4.4 <3.5.0 >=3.5.1 <4.0.0 @jupyterlab/apputils =3.4.4 <3.5.0 >=3.5.1 <4.0.0 @jupyterlab/console =5.4.4 <5.5.0 >=5.5.1 <6.0.0 @jupyterlab/coreutils =3.4.4 <3.5.0 >=3.5.1 <4.0.0 @jupyterlab/notebook =6.4.4 <6.5.0 >=6.5.1 <7.0.0 @jupyterlab/services =3.4.4 <3.5.0 >=3.5.1 <4.0.0 @jupyterlab/statusbar =3.4.4 <3.5.0 >=3.5.1 <4.0.0 @jupyterlab/translation

Other labextensions (built into JupyterLab) app dir: /opt/miniconda3/share/jupyter/lab jupyterlab-dash v0.4.2 enabled OK

Build recommended, please run jupyter lab build: jupyterlab-dash needs to be included in build

- Git version:
<!-- Results of `git --version` -->
```sh
# git --version
git version 2.25.1
Command Line Output
[W 2023-03-20 03:38:17.634 
ServerApp] 404 GET /git/settings?
version=0.41.0&1679283497734 
(172.18.0.1) 0.81ms referer=None
Web Browser Output
69.6374f7d6f5f3a1e80ebc.js?v=6374f7d6f5f3a1e80ebc:1 Failed to load the jupyterlab-git server extension settings Error: Git server extension is unavailable. Please ensure you have installed the JupyterLab Git server extension by running: pip install --upgrade jupyterlab-git. To confirm that the server extension is installed, run: jupyter server extension list.
    at 69.6374f7d6f5f3a1e80ebc.js?v=6374f7d6f5f3a1e80ebc:1:177876
    at async activate (69.6374f7d6f5f3a1e80ebc.js?v=6374f7d6f5f3a1e80ebc:1:177406)
welcome[bot] commented 1 year ago

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

fcollonval commented 1 year ago

Hey @cjbd it is likely because the server extension part of this extension is not enable. Could you execute

jupyter server extension list

cjbd commented 1 year ago

@fcollonval thanks for the update, pls find command output, it's enabled

# jupyter server extension list
Config dir: /root/.jupyter

Config dir: /opt/miniconda3/etc/jupyter
    jupyter_resource_usage enabled
    - Validating jupyter_resource_usage...
      jupyter_resource_usage 0.7.2 OK
    jupyter_server_mathjax enabled
    - Validating jupyter_server_mathjax...
      jupyter_server_mathjax  OK
    jupyterlab enabled
    - Validating jupyterlab...
      jupyterlab 3.4.4 OK
    jupyterlab_git enabled
    - Validating jupyterlab_git...
      jupyterlab_git 0.41.0 OK
    nbclassic enabled
    - Validating nbclassic...
      nbclassic 0.5.2 OK
    nbdime enabled
    - Validating nbdime...
      nbdime 3.1.1 OK
    notebook_shim enabled
    - Validating notebook_shim...
      notebook_shim  OK
    panel.io.jupyter_server_extension enabled
    - Validating panel.io.jupyter_server_extension...
      panel.io.jupyter_server_extension  OK

Config dir: /usr/local/etc/jupyter
cjbd commented 1 year ago

something that might not be relevant to this, i also had trouble with panel extension, it was giving simlar 404 error for /panel/... just now i found that if i don't use nginx and launch jupyterlab from localhost, the panel extension is working fine, while git extension is still giving 404 error in the command console

fcollonval commented 1 year ago

Do you filter endpoints?

If yes you are likely filtering the endpoints of this extension?

cjbd commented 1 year ago

@fcollonval no, i don't know how to do that...

AlvinnnnA commented 1 year ago

Has a similar issue here. My setup includes a jupyterhub as docker container that spawns jupyterlab containers. All reverse proxy-ed through a nginx server. Everything works fine until I wish to install a git extension. conda install works and after installation the output is:

$ jupyter server extension list
Config dir: /home/jovyan/.jupyter

Config dir: /opt/conda/etc/jupyter
--Other extensions omitted...
    jupyterlab_git enabled
    - Validating jupyterlab_git...
Package jupyterlab_git took 0.0258s to import
      jupyterlab_git 0.41.0 OK

Config dir: /usr/local/etc/jupyter

and

$ jupyter labextension list
JupyterLab v3.6.3
/opt/conda/share/jupyter/labextensions
        jupyterlab_pygments v0.2.2 enabled OK (python, jupyterlab_pygments)
        nbdime-jupyterlab v2.2.0 enabled OK
        @jupyterlab/git v0.41.0 enabled OK (python, jupyterlab-git)

Other labextensions (built into JupyterLab)
   app dir: /opt/conda/share/jupyter/lab

However when I reload the page this pops up and the logs from the lab container reads:

Screenshot 2023-07-17 at 15 31 16

and the logs concerning the extension from the lab container reads:

[W 2023-07-17 07:15:31.012 ServerApp] 404 GET /user/alvinnnn/git/settings?version=0.41.0&1689578130935 (alvinnnn@my-IP-address) 23.85ms

and

[W 2023-07-17 07:16:36.266 ServerApp] 404 GET /user/alvinnnn/git/settings?version=0.41.0&1689578196194 (alvinnnn@my-IP-address) 21.42ms

Really not sure what was the issue but seemed very close to this

fcollonval commented 1 year ago

I would guess that your nginx is likely to filter out new API endpoints.

You should look at the proxy log.