5

I'm a quite new on Poetry usage. My need is just to push my Python library on my personal Google Artifact Registry. After launching those commands :

poetry config virtualenvs.create false
poetry config $repoName $urlOfTheRemoteArtifactRegistry
poetry config http-basic.$repoName $userName $userPwd
poetry publish -r $repoName --build

I have this stack error :

HTTP Error 413: Request Entity Too Large

  at /usr/local/Cellar/poetry/1.1.7/libexec/lib/python3.9/site-packages/poetry/publishing/uploader.py:216 in _upload
      212│                     self._register(session, url)
      213│                 except HTTPError as e:
      214│                     raise UploadError(e)
      215│ 
    → 216│             raise UploadError(e)
      217│ 
      218│     def _do_upload(
      219│         self, session, url, dry_run=False
      220│     ):  # type: (requests.Session, str, Optional[bool]) -> None

A 413 HTTP error means that my payload is to large, but in fact when i

du -h d 0

it, i've found only 100K. Is there a hidden option/hard-limit in poetry side ? Or it's in GCP ?

Any help/advise/thumbup would be appreciated.

Thank you in advance !

Data minion
  • 49
  • 1
  • 3
  • *i've found only 100Kb ;) – Data minion Jul 16 '21 at 10:27
  • 1
    I'm having the same issue in our pipelines using Twine to upload our artifacts to GCP Artifact Registry: have you solved? I'm thinking of some limit on their web server, but I guess we'll be contacting google to get some more details, since there's nothing about any limit in the documentation, as far as I can see. – fedexist Jul 19 '21 at 15:01
  • Hi @fedexist ! In fact when you use the command : "poetry config http-basic.$repoName $userName $userPwd" Poetry uses Basic auth to log. You cannot use another protocole with this command, unless you try to curl with a Bearer auth which can work with google auth. As a workaround, for publishing we are using poetry which works like a charm. "twine upload --repository-url https://$artifactURL" – Data minion Jul 21 '21 at 08:25

2 Answers2

2

This is fixed in the pre-release version of poetry 1.2.0a2

Here I have tested and it's working already for me. https://github.com/Bharathkumarraju/poetry-gcp-pypi

  • Thanks a lot. In your example on gh you didn't need to auth to the Google API ? – Data minion Aug 12 '21 at 10:45
  • @BharathKumarRaju Dasararaju I followed the steps that you mentioned with version 1.2.1 and still get 401 error. The steps are: 1. poetry self add keyrings.google-artifactregistry-auth:1.1.1 2. poetry config repositories.google https://europe-python.pkg.dev/leon-gcp/pypi/ 3. gcloud auth application-default login 4. poetry publish -r google --build and the error: HTTP Error 401: Unauthorized | b'The request does not have valid authentication credentials.\n' I wonder if I missed some step? thanks – LeonBam Dec 06 '22 at 18:48
-1

[Update] I've solved the issue. It was related to the authentification and not to the size of the artifact. The 413 HTTP error led us astray about the actual root cause.

Data minion
  • 49
  • 1
  • 3
  • 2
    How did you solve this @Data minion. I am facing the same issue while uploadiing to gcp artifact pypi repo using poetry? – BharathKumarRaju Dasararaju Jul 30 '21 at 00:24
  • Hi @BharathKumarRaju ! Sorry for the late reply My solution was just a workaround actually. It consists to use a twine command for publishing instead of poetry. ’’’ twine upload --repository-url $url ’’’ – Data minion Aug 05 '21 at 09:52
  • The issue seems to be related to a lack of available auth protocols in poetry through the command line. In fact, you can only use basic auth with it. If you try to curl to ACR url with Bearer for exemple, it should work (by work i mean no 401/403 http error. Hope that it helped. – Data minion Aug 05 '21 at 09:58
  • I ran into the same issue and it turned out I was using an outdated version of twine. Just for future readers, as I ended up in this thread as well :) – Saskia Keil Jan 25 '22 at 22:21