pypa / twine

Utilities for interacting with PyPI

Home Page:https://twine.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

twine upload fails with ERROR HTTPError: 401 Unauthorized from http://pip.myserver.com/

kumarbka opened this issue · comments

Your Environment

Thank you for taking the time to report an issue.

To more efficiently resolve this issue, we'd like to know some basic information about your system and setup.

  1. Your operating system:
    Ubuntu 22.04.1 LTS

  2. Version of python you are running:

python --version

Python 3.10.12
  1. How did you install twine? Did you use your operating system's package manager or pip or something else?
    pip

  2. Version of twine you have installed (include complete output of):

twine --version

twine version 4.0.2 (importlib-metadata: 4.6.4, keyring: 23.5.0, pkginfo: 1.9.6, requests: 2.25.1, requests-toolbelt: 1.0.0, urllib3: 1.26.5
  1. Which package repository are you targeting?
    I am trying to upload the customised package into my private PyPi server.

If you're having issues uploading a specific package, you must include a copy of the following:

  • The package's PKG-INFO file
  • A redacted version of your .pypirc file (REMOVE ALL USERNAMES & PASSWORDS BEFORE UPLOADING)

The Issue

I have set up my own private PyPI server on top of Kubernetes, I have ingress which controllers the authentication as below. I am getting an error message when I try to upload the package. But the same credentials work when I browse through browsers like (http://pip.myserver.com/simple/). Kindly help to fix the issue.

Ingress Annotations as below:

nginx.ingress.kubernetes.io/auth-secret: pip-auth
nginx.ingress.kubernetes.io/auth-type: basic

When I checked the POD in the kubernetes it has the following process.

 /usr/local/bin/python /usr/local/bin/pypi-server run -p 8080 --server gunicorn -vvvv

Steps to Reproduce

N/A

There's too little information here to help you.

  • we don't know what you're using for your internal PyPI server or what it expects. For example, does it expect registered users that need to authenticate to it to upload?
  • you can check kubernetes resources but you haven't told us if you looked at the logs of your ingress controller to see if that is returning the 401 or if the server you're running is
  • you haven't shared the way you attempted to upload to your server

Regardless of any of that information, I'm 99% certain this is an issue with how you have configured things in kubernetes. Just because you can browse to the index doesn't mean you have fully configured things such that uploads work. Given that, I'm closing this issue as I don't believe there to be much for the twine project to do to help you.

thanks for your quick response.

I have isolated the issue by eliminating the "ingress" authentication. I am able to upload the package into my private PyPI repo after removing auth annotations from ingress. so I just need to dig further into why twine is not working with ingress.