pypi / warehouse

The Python Package Index
https://pypi.org
Apache License 2.0
3.6k stars 964 forks source link

HTTPError: 413 Request Entity Too Large from https://pypi.org/legacy/ #17076

Closed andife closed 1 week ago

andife commented 1 week ago

Describe the bug Trying to publish wheels to pypi results in the error "HTTPError: 413 Request Entity Too Large

The original issue can be found at

https://github.com/pypa/gh-action-pypi-publish/issues/285

Expected behavior

it should work

To Reproduce

Currently, an automatic publish attempt runs weekly via schedule, but if the following PR (https://github.com/onnx/onnx/pull/6540) is merged, it can also be triggered manually

My Platform

Additional context

ewdurbin commented 1 week ago

How large is the wheel that you're attempting to upload? PyPI has a request size limit of 1 GiB enforced by the load balancer, which cannot be raised.

andife commented 1 week ago

I assume that I have approx. 30 wheels of approx. 14 mb each + one sdist. I think that should be well under 1GB. With test.pypi the upload works without problems

The error message:

INFO     username set by command options                                        
INFO     password set by command options                                        
INFO     username: __token__                                                    
INFO     password: <hidden>                                                     
Uploading onnx_weekly-1.18.0.dev20241111-cp310-cp310-macosx_12_0_universal2.whl
INFO     Response from https://pypi.org/legacy/:                                
         413 Request Entity Too Large                                           
INFO     <html>                                                                 
         <head><title>413 Request Entity Too Large</title></head>               
         <body>                                                                 
         <center><h1>413 Request Entity Too Large</h1></center>                 
         <hr><center>nginx</center>                                             
         </body>                                                                
         </html>                                                                

ERROR    HTTPError: 413 Request Entity Too Large from https://pypi.org/legacy/  
         Request Entity Too Large      
ewdurbin commented 1 week ago

Is the file onnx_weekly-1.18.0.dev20241111-cp310-cp310-macosx_12_0_universal2.whl available somewhere for inspection?

andife commented 1 week ago

It was published to test.pypi during the same run: https://test-files.pythonhosted.org/packages/29/89/a8ae8c8040c5447062d421eff0829e2b7d3ce1ab6f47744355c334221a1d/onnx_weekly-1.18.0.dev20241111-cp310-cp310-macosx_12_0_universal2.whl

https://test.pypi.org/project/onnx-weekly/#onnx_weekly-1.18.0.dev20241111-cp310-cp310-macosx_12_0_universal2.whl

ewdurbin commented 1 week ago

Hm, from logs, I see:

WARNING Only PyPI and TestPyPI support attestations; if you experience
failures, remove the --attestations flag and re-try this command

I'm curious what the result of that for debugging is. I wonder if the attestation part of the request is pushing it over the client body size limit of 1024M... somehow. (Edit: Not this, see below)

ewdurbin commented 1 week ago

ah, another ?... the upload endpoint is https://upload.pypi.org/legacy and the error is being emitted from https://pypi.org/legacy

ewdurbin commented 1 week ago

Yep, that's it.

https://github.com/onnx/onnx/commit/3763953a7f7b2a7bbd86877bff7edbf39f331af8 is likely root cause.

The upload endpoint was coded as https://pypi.org/legacy (it should be https://upload.pypi.org/legacy) which has a much stricter body size limit, so the upload is bounced before warehouse gets a chance to say "hey this isn't the upload endpoint"