Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[websockets.exceptions.InvalidStatusCode: server rejected WebSocket connection: HTTP 403] #6605

Closed
1 task done
abuyusif01 opened this issue Nov 29, 2023 · 4 comments
Closed
1 task done
Labels
bug Something isn't working

Comments

@abuyusif01
Copy link

abuyusif01 commented Nov 29, 2023

Describe the bug

am using gradio_client 0.7.0

take a look at the screenshot below, I tracked the authentication module and the only conclusion i can come up with is:
there's a bug somewhere in it. as u can see when i exit right after the post request in _login() the cookies values are valid (i tested this in browser, U can see the cookies in browser window are thesame as the ones in vscode terminal.) and ofcourse i got an empty json when the auth credentials are wrong. this make sense. But the moment i uncomment the exit and continue executing the module. i got a {'details': 'Not Authenticated'} when using h2ogpt_gradio utils. and i got [websockets.exceptions.InvalidStatusCode: server rejected WebSocket connection: HTTP 403] using pure gradio_client

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

try to authenticate a user with h2ogpt where --auth option is enabled.

Screenshot

bugs_edited

Logs

No response

System Info

# OS: Ubuntu 22.04.3 LTS x86_64
# Host: g5.4xlarge
# Kernel: 6.2.0-1016-aws
# CPU: AMD EPYC 7R32 (16) @ 3.304GHz
# GPU: NVIDIA A10G
# Memory: 7351MiB / 63604MiB

ubuntu@b9c173f8ab79:~$ gradio environment
Gradio Environment Information:
------------------------------
Operating System: Linux
gradio version: 3.50.2
gradio_client version: 0.6.1

------------------------------------------------
gradio dependencies in your environment:

aiofiles: 23.2.1
altair: 5.2.0
fastapi: 0.104.1
ffmpy: 0.3.1
gradio-client==0.6.1 is not installed.
httpx: 0.25.2
huggingface-hub: 0.16.4
importlib-resources: 6.1.1
jinja2: 3.1.2
markupsafe: 2.1.3
matplotlib: 3.7.1
numpy: 1.22.0
orjson: 3.9.10
packaging: 23.2
pandas: 1.5.3
pillow: 9.5.0
pydantic: 1.10.13
pydub: 0.25.1
python-multipart: 0.0.6
pyyaml: 6.0.1
requests: 2.31.0
semantic-version: 2.10.0
typing-extensions: 4.8.0
uvicorn: 0.24.0.post1
websockets: 11.0.3
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.


gradio_client dependencies in your environment:

fsspec: 2023.10.0
httpx: 0.25.2
huggingface-hub: 0.16.4
packaging: 23.2
requests: 2.31.0
typing-extensions: 4.8.0
websockets: 11.0.3

Severity

Blocking usage of gradio

@abuyusif01 abuyusif01 added the bug Something isn't working label Nov 29, 2023
@pngwn
Copy link
Member

pngwn commented Nov 29, 2023

What version of gradio does the gradio app you are connecting to use?

@abuyusif01
Copy link
Author

abuyusif01 commented Nov 29, 2023

The server gradio version is: 3.50.2

I've upgraded gradio app to 4.7.1, that results in replicating this issue: #6601

Client side

 File "/home/abuyusif01/python3/lib/python3.11/site-packages/httpx/_models.py", line 758, in raise_for_status
    raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Server error '500 Internal Server Error' for url 'https://ec2-18-................us-east-2.compute.amazonaws.com/queue/data'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500

Server side

  File "/h2ogpt_conda/lib/python3.10/site-packages/gradio/routes.py", line 668, in queue_data
    blocks._queue.attach_data(body)
  File "/h2ogpt_conda/lib/python3.10/site-packages/gradio/queueing.py", line 161, in attach_data
    raise ValueError("Event not found", event_id)
ValueError: ('Event not found', 'c322dc14d5ed48ec9e026e7ce357542a')

@abidlabs
Copy link
Member

We're working on fixing the latter issue here: #6556

@abidlabs
Copy link
Member

Should be fixed in the Gradio 4.9.0 or later @abuyusif01!

S3Studio added a commit to S3Studio/GPT-SoVITS that referenced this issue Mar 1, 2024
If auth is set to gradio, calling from gradio_client to api will fail with exception:
server rejected WebSocket connection: HTTP 403
Current gradio version in GPT-SoVITS is 3.38.0 and official fix is on 4.9.0 according to:
gradio-app/gradio#6605
This commit upgrades gradio to latest version of 4.19.2 and modified deprecated arguments in code, and will fix server-side problem.
On the other hand, the client-side of gradio_client of the latest version of 0.10.1 raises a new exception when uploading a file to a api protected by auth:
ValueError: None
The fix for the problem has no effect to the server-side due to ongoing pull request:
gradio-app/gradio#7555
so this commit may be useful.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants