pypa / gh-action-pypi-publish

The blessed :octocat: GitHub Action, for publishing your :package: distribution files to PyPI, the tokenless way: https://github.com/marketplace/actions/pypi-publish
https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
BSD 3-Clause "New" or "Revised" License
928 stars 87 forks source link

Invalid API Token: token with user restriction without a user #222

Closed byrdie closed 7 months ago

byrdie commented 7 months ago

I've been using this action across all my projects for a while now and everything has been working perfectly.

Today however, when I tried to publish my project, I encountered the following error:

Checking dist/optika-0.0.10-py3-none-any.whl: PASSED
Checking dist/optika-0.0.10.tar.gz: PASSED
Uploading distributions to https://upload.pypi.org/legacy/
Uploading optika-0.0.10-py3-none-any.whl
25l
  0% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/4.7 MB • --:-- • ?
  4% ━╸━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.2/4.7 MB • 00:01 • 10.6 MB/s
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.7/4.7 MB • 00:00 • 41.8 MB/s
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.7/4.7 MB • 00:00 • 41.8 MB/s
WARNING  Error during upload. Retry with the --verbose option for more details. 
ERROR    HTTPError: 403 Forbidden from https://upload.pypi.org/legacy/          
         Invalid API Token: token with user restriction without a user

Does anyone know what changed? Do I need to regenerate new tokens or something?

webknjaz commented 7 months ago

Not sure, but it's a good opportunity to migrate to tokenless publishing 😉

webknjaz commented 7 months ago

FWIW here's what's you're likely hitting https://github.com/pypi/warehouse/blob/5eba9cb/warehouse/macaroons/caveats/__init__.py#L108

webknjaz commented 7 months ago

Here's a similar report https://github.com/pypi/support/issues/3740

webknjaz commented 7 months ago

It seems like @di also reverted something that might've fixed the problem: https://github.com/pypi/warehouse/pull/15588. So I suggest you retry your job to see if it's been fixed already.

byrdie commented 7 months ago

@webknjaz, seems to be working now, thanks for your help!