sonatype-nexus-community / nexus-repository-composer

Composer support for the Nexus Repository Manager (work in progress!)
Eclipse Public License 1.0
211 stars 82 forks source link

Dev-master libs proxying issue #114

Closed workingoctopus closed 1 year ago

workingoctopus commented 2 years ago

I am trying to download 'dev-master' libs via proxy sonatype rep and getting incorrect URL so it throws a 502 error.

An example:

The "https://<nexus.local>/repository/<proxy_rep>/liuggio/statsd-client-bundle/dev-master/liuggio-statsd-client-bundle-dev-master.zip" file could not be downloaded (HTTP/1.1 502 Bad Gateway)

I am using the latest composer module for nexus.

My composer.json configuration is :

"repositories": [
        {
            "type": "composer",
            "url": "https://<local-nexus-composer-registry>/repository/<proxy_rep>/"
        },
        {
            "packagist.org": false
        }
    ]
composer.lock : 
    "name": "liuggio/statsd-client-bundle",
            "version": "dev-master",
            "target-dir": "Liuggio/StatsDClientBundle",
composer.json: 
"liuggio/statsd-client-bundle": "1.8.x-dev"

How may I solve this issue? Every other lib with any version but 'dev-master' has no any issues with proxying.

Jonomir commented 2 years ago

We have the same problem, just with the dev-add-php8 version of this package: https://packagist.org/packages/needle-project/laravel-rabbitmq#dev-add-php8

Maybe if the version isn't in an expected format, it fails?

elchenberg commented 1 year ago

I have this problem with the dev-master version of jetbrains/phpstorm-stubs.

From the debug log:

2022-08-01 11:32:55,975+0000 DEBUG [qtp1922519710-101]  *UNKNOWN org.sonatype.nexus.common.io.CooperatingFuture - Completing /jetbrains/phpstorm-stubs/dev-master/jetbrains-phpstorm-stubs-dev-master.zip?{} (1 threads cooperating) with exception
java.io.UncheckedIOException: java.io.IOException: version not found
    at org.sonatype.nexus.repository.composer.internal.ComposerProxyFacetImpl.getZipballUrl(ComposerProxyFacetImpl.java:212)

Maybe the issue is that the plugin does not look at the dev versions of packages at all.

It uses buildPackagePath and buildPackagePath uses this template: PACKAGE_JSON_PATH = "p2/%s/%s.json" to build the URL.

So for my package the URL path will be /p2/jetbrains/phpstorm-stubs.json but to find the dev-master version Nexus would need to look at /p2/jetbrains/phpstorm-stubs~dev.json (https://repo.packagist.org/p2/jetbrains/phpstorm-stubs~dev.json).

Zuko commented 1 year ago
In DownloadManager.php line 402:

  Package snilius/twig-sort-by-field-dev-master must have a source or dist specified  

This package still cannot by downloaded with proxy…

composer.lock

        {
            "name": "snilius/twig-sort-by-field",
            "version": "dev-master",
            "require-dev": {
                "doctrine/collections": "^1.3",
                "php": ">=5.5.9",
                "phpunit/phpunit": "~4.5",
                "twig/extensions": "~1.2"
            },
            "default-branch": true,
            "type": "library",
            "autoload": {
                "psr-4": {
                    "Snilius\\Twig\\": "src/"
                }
            },
            "license": [
                "Apache-2.0"
            ],
            "authors": [
                {
                    "name": "Victor Häggqvist",
                    "email": "victor@snilius.com"
                }
            ],
            "description": "A Twig Extension filter to sort an array of entries (objects or arrays) by the specified field",
            "time": "2016-01-27T00:29:51+00:00"
        },
elchenberg commented 1 year ago

@Zuko To me it looks as if you are having this issue: https://github.com/sonatype-nexus-community/nexus-repository-composer/issues/123

Zuko commented 1 year ago

@elchenberg Thanks