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

The upload --skip-existing command does not work on a Nexus Repository instance with a PostgreSQL database #1044

Open
1 task done
StykMartin opened this issue Jan 9, 2024 · 7 comments

Comments

@StykMartin
Copy link

StykMartin commented Jan 9, 2024

Is there an existing issue for this?

  • I have searched the existing issues (open and closed), and could not find an existing issue

What keywords did you use to search existing issues?

nexus
PostgreSQL
skip-existing

Please describe why your using this option

Hello maintainers,

We recently migrated from OrientDB to the PostgreSQL database for Nexus Repository Pro (without upgrading Nexus version).
We noticed that the --skip-existing option does not work anymore.
The problem is that the response from Nexus Repository Pro contains different error messages depending on the DB.

OrientDB

Repository does not allow updating assets: pypi-hosted

PostgreSQL

pypi-hosted/packages/<package>/<version>/<package>-<version>-py3-none-any.whl cannot be updated

Current logic does not cover this behavior

# Nexus Repository OSS (https://www.sonatype.com/nexus-repository-oss)
or (status == 400 and any("updating asset" in x for x in [reason, text]))

Anything else you'd like to mention?

No response

@sigmavirus24
Copy link
Member

Frankly you're paying for Nexus and they're giving two very different messages for the same error. Given how tenuous our ability to detect this already is, I'd strongly push on Nexus fixing this instead of us.

@andrewharle
Copy link

Same issue with Nexus OSS (3.70.1-02) using the new embedded H2 database.

html output

twine upload --repository-url ${NEXUS_HOST_ADDR}/ --skip-existing $(ls *.whl)

<!DOCTYPE html>
<html lang="en">
<head>
    <title>400 - Sonatype Nexus Repository</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>


    <link rel="icon" type="image/png" href="../../static/rapture/resources/safari-favicon-32x32.png?3.70.1-02" sizes="32x32">
    <link rel="mask-icon" href="../../static/rapture/resources/favicon-white.svg?3.70.1-02" color="#00bb6c">
    <link rel="icon" type="image/png" href="../../static/rapture/resources/favicon.svg?3.70.1-02" sizes="16x16">

    <link rel="stylesheet" type="text/css" href="../../static/css/nexus-content.css?3.70.1-02"/>
</head>
<body>
<div class="nexus-header">
    <a href="../..">
        <div class="product-logo">
            <img src="../../static/rapture/resources/nxrm-reverse-icon.png?3.70.1-02" alt="Product logo"/>
        </div>
        <div class="product-id">
            <div class="product-id__line-1">
                <span class="product-name">Sonatype Nexus Repository</span>
            </div>
            <div class="product-id__line-2">
                <span class="product-spec">OSS 3.70.1-02</span>
            </div>
        </div>
    </a>
</div>

<div class="nexus-body">
    <div class="content-header">
        <img src="../../static/rapture/resources/icons/x32/exclamation.png?3.70.1-02" alt="Exclamation point" aria-role="presentation"/>
        <span class="title">Error 400</span>
        <span class="description">Bad Request</span>
    </div>
    <div class="content-body">
        <div class="content-section">
            pypi-hosted/packages/<package>/<version>/<package>-<version>-py3-none-any.whl cannot be updated
        </div>
    </div>
</div>
</body>
</html>

@evgevyr
Copy link

evgevyr commented Aug 16, 2024

Same issue with Nexus OSS (3.71.0-06) using the new embedded H2 database.

twine upload --verbose --skip-existing ./wheels/*
<!DOCTYPE html>
<html lang="en">
<head>
  <title>400 - Sonatype Nexus Repository</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <link rel="icon" type="image/png" href="../../static/rapture/resources/safari-favicon-32x32.png?3.71.0-06" sizes="32x32">
  <link rel="mask-icon" href="../../static/rapture/resources/favicon-white.svg?3.71.0-06" color="#00bb6c">
  <link rel="icon" type="image/png" href="../../static/rapture/resources/favicon.svg?3.71.0-06" sizes="16x16">
  <link rel="stylesheet" type="text/css" href="../../static/css/nexus-content.css?3.71.0-06"/>
</head>
<body>
<div class="nexus-header">
  <a href="../..">
    <div class="product-logo">
      <img src="../../static/rapture/resources/nxrm-reverse-icon.png?3.71.0-06" alt="Product logo"/>
    </div>
    <div class="product-id">
      <div class="product-id__line-1">
        <span class="product-name">Sonatype Nexus Repository</span>
      </div>
      <div class="product-id__line-2">
        <span class="product-spec">OSS 3.71.0-06</span>
      </div>
    </div>
  </a>
</div>

<div class="nexus-body">
  <div class="content-header">
    <img src="../../static/rapture/resources/icons/x32/exclamation.png?3.71.0-06" alt="Exclamation point" aria-role="presentation"/>
    <span class="title">Error 400</span>
    <span class="description">Bad Request</span>
  </div>
  <div class="content-body">
    <div class="content-section">
      pip-alpine/packages/django/5.0.8/Django-5.0.8-py3-none-any.whl cannot be updated
    </div>
  </div>
</div>
</body>
</html>


ERROR HTTPError: 400 Bad Request from
      https://localhost/repository/pip-alpine/
      pip-alpine/packages/django/5.0.8/Django-5.0.8-py3-none-any.whl cannot be updated

@StykMartin
Copy link
Author

Since the FOSS version is now affected, I think we should address this issue. I'll look into it and provide a patch to fix it.

@sigmavirus24
Copy link
Member

Glad to hear you're sending a fix to Nexus now that their broken code is open source

@WatskeBart
Copy link

Confirming here on Nexus-OSS v3.37.0-12 with embedded H2 db.

It seems like the changed output is since >=v3.71.0, everything before that also supported the OrientDB which is deprecated since then.

@StykMartin any luck on cooking up a patch?

@StykMartin
Copy link
Author

@WatskeBart
I have it in my backlog, but since everyone is experiencing the same problem, I will bump it up in priority. I'll cook it this week and see how it goes.

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

No branches or pull requests

5 participants