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

Sankaku API is experiencing a 500 error on the huggingface space #8

Open
narugo1992 opened this issue Jun 19, 2023 · 4 comments
Open

Comments

@narugo1992
Copy link
Contributor

narugo1992 commented Jun 19, 2023

The Sankaku library (version 1.0.3) encounters a 500 error when logging into the huggingface space environment.

import asyncio
from sankaku import SankakuClient

async def main():
    client = SankakuClient()
    await client.login(login='username', password='password')

if __name__ == '__main__':
    asyncio.run(main())

The output result is:

Traceback (most recent call last):
  File "test_login.py", line 12, in <module>
    asyncio.run(main())
  File "/usr/local/lib/python3.8/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 612, in run_until_complete
    return future.result()
  File "test_login.py", line 8, in main
    await client.login(login='username', password='password')
  File "/home/user/.local/lib/python3.8/site-packages/sankaku/clients/clients.py", line 92, in login
    await self._login_via_credentials(login, password)  # type: ignore[arg-type]
  File "/home/user/.local/lib/python3.8/site-packages/sankaku/clients/clients.py", line 38, in _login_via_credentials
    response = await self._http_client.post(
  File "/home/user/.local/lib/python3.8/site-packages/sankaku/clients/http_client.py", line 94, in post
    return await self.request("POST", url, **kwargs)
  File "/home/user/.local/lib/python3.8/site-packages/sankaku/clients/http_client.py", line 71, in request
    raise errors.SankakuServerError(
sankaku.errors.SankakuServerError: [500] Invalid response content type: content_type=text/html.

I tried to output the text in the response, and it contains:

<html>
<head><title>500 Internal Server Error</title></head>
<body>
<center><h1>500 Internal Server Error</h1></center>
<hr><center>nginx</center>
</body>
</html>
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->

However, when running locally and on several other servers, this issue did not occur, and the login was successful. Therefore, it is possible that some necessary configurations (such as Referer, User-Agent, etc.) are missing during the login. Is it possible to optimize this?

BTW: You can check the huggingface space here: https://huggingface.co/spaces/narugo/jupyterlab and duplicate it for testing in a real environment.

@zerex290
Copy link
Owner

zerex290 commented Jul 1, 2023

I am apologize for not answering for so long. Regarding this issue, currently I can't solve this problem. Such unwanted behaviour also happens at github workflows (issue #6), so I think that these issues are similar. Assuming this, I tried to add extra headers for HTTP requests, but nothing changed.

@narugo1992
Copy link
Contributor Author

I am apologize for not answering for so long. Regarding this issue, currently I can't solve this problem. Such unwanted behaviour also happens at github workflows (issue #6), so I think that these issues are similar. Assuming this, I tried to add extra headers for HTTP requests, but nothing changed.

Yes, I also find this problem: https://github.com/narugo1992/gchar/actions/runs/5445861889/jobs/9905734965#step:9:50

When I tried to access the Sankaku API using requests (without using the sankaku library), it worked fine on my local machine and one of my servers, but it failed to work on GitHub Actions. I suspect that some of the cloud resources may have been blacklisted by the Sankaku server. I will try to open a support ticket and issue on GitHub to see if this situation can be resolved.

@narugo1992
Copy link
Contributor Author

I opened a dicussion here: https://github.com/orgs/community/discussions/59975

@zerex290
Copy link
Owner

zerex290 commented Jul 7, 2023

If the reason of response 500 from sankaku server is blocking by IP address, I think the restriction can by bypassed by using proxy server. I'll rent a private proxy server to try to check it with github workflows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants