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

composer update with version 1.10.12 throws RuntimeException #9196

Closed
leoloso opened this issue Sep 9, 2020 · 11 comments
Closed

composer update with version 1.10.12 throws RuntimeException #9196

leoloso opened this issue Sep 9, 2020 · 11 comments

Comments

@leoloso
Copy link
Sponsor

leoloso commented Sep 9, 2020

Apologies if you're aware of this problem, but I don't see it issued.

My composer.json:

{
    "name": "graphql-api/graphql-api",
    "type": "library",
    "description": "GraphQL API for WordPress",
    "keywords": [
        "PoP",
        "WordPress",
        "GraphQL",
        "API"
    ],
    "homepage": "https://github.com/GraphQLAPI/graphql-api",
    "license": "MIT",
    "authors": [
        {
            "name": "Leonardo Losoviz",
            "email": "leo@getpop.org",
            "homepage": "https://getpop.org"
        }
    ],
    "minimum-stability": "dev",
    "prefer-stable": true,
    "require": {
        "php": "~7.4",
        "erusev/parsedown": "^1.7",
        "pop-schema/generic-customposts": "dev-master",
        "pop-schema/commentmeta-wp": "dev-master",
        "pop-schema/comments-wp": "dev-master",
        "pop-schema/custompostmedia-wp": "dev-master",
        "pop-schema/custompostmeta-wp": "dev-master",
        "getpop/engine-wp": "dev-master",
        "graphql-by-pop/graphql-server": "dev-master",
        "graphql-by-pop/graphql-clients-for-wp": "dev-master",
        "graphql-by-pop/graphql-endpoint-for-wp": "dev-master",
        "pop-schema/media-wp": "dev-master",
        "pop-schema/pages-wp": "dev-master",
        "pop-schema/posts-wp": "dev-master",
        "pop-schema/taxonomymeta-wp": "dev-master",
        "pop-schema/taxonomyquery-wp": "dev-master",
        "pop-schema/post-tags-wp": "dev-master",
        "pop-schema/basic-directives": "dev-master",
        "pop-schema/user-roles-access-control": "dev-master",
        "pop-schema/user-roles-wp": "dev-master",
        "pop-schema/user-state-wp": "dev-master",
        "pop-schema/usermeta-wp": "dev-master",
        "pop-schema/users-wp": "dev-master",
        "symfony/expression-language": "^5.1",
        "wikimedia/composer-merge-plugin": "^1.4"
    },
    "require-dev": {
        "phpstan/phpstan": "^0.12",
        "phpunit/phpunit": ">=9.3",
        "rector/rector": "dev-master#0deb805a3124e60b042939f52acbc5c66abdde42",
        "squizlabs/php_codesniffer": "^3.0",
        "szepeviktor/phpstan-wordpress": "^0.6.2",
        "johnpbloch/wordpress": ">=5.5"
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://wpackagist.org"
        }
    ],
    "autoload": {
        "psr-4": {
            "GraphQLAPI\\GraphQLAPI\\": "src"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "GraphQLAPI\\GraphQLAPI\\": "tests"
        }
    },
    "scripts": {
        "test": "phpunit",
        "check-style": "phpcs src tests",
        "fix-style": "phpcbf src tests",
        "analyse": "phpstan analyse -c phpstan.neon.dist",
        "downgrade-code": "rector process --dry-run"
    },
    "extra": {
        "wordpress-install-dir": "vendor/wordpress/wordpress",
        "branch-alias": {
            "dev-master": "1.0-dev"
        },
        "merge-plugin": {
            "include": [
                "composer.local.json"
            ],
            "recurse": true,
            "replace": false,
            "ignore-duplicates": false,
            "merge-dev": true,
            "merge-extra": false,
            "merge-extra-deep": false,
            "merge-scripts": false
        }
    },
    "config": {
        "sort-packages": true
    }
}

Output of composer diagnose:

Checking composer.json: WARNING
The package "rector/rector" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.
require.pop-schema/generic-customposts : unbound version constraints (dev-master) should be avoided
require.pop-schema/commentmeta-wp : unbound version constraints (dev-master) should be avoided
require.pop-schema/comments-wp : unbound version constraints (dev-master) should be avoided
require.pop-schema/custompostmedia-wp : unbound version constraints (dev-master) should be avoided
require.pop-schema/custompostmeta-wp : unbound version constraints (dev-master) should be avoided
require.getpop/engine-wp : unbound version constraints (dev-master) should be avoided
require.graphql-by-pop/graphql-server : unbound version constraints (dev-master) should be avoided
require.graphql-by-pop/graphql-clients-for-wp : unbound version constraints (dev-master) should be avoided
require.graphql-by-pop/graphql-endpoint-for-wp : unbound version constraints (dev-master) should be avoided
require.pop-schema/media-wp : unbound version constraints (dev-master) should be avoided
require.pop-schema/pages-wp : unbound version constraints (dev-master) should be avoided
require.pop-schema/posts-wp : unbound version constraints (dev-master) should be avoided
require.pop-schema/taxonomymeta-wp : unbound version constraints (dev-master) should be avoided
require.pop-schema/taxonomyquery-wp : unbound version constraints (dev-master) should be avoided
require.pop-schema/post-tags-wp : unbound version constraints (dev-master) should be avoided
require.pop-schema/basic-directives : unbound version constraints (dev-master) should be avoided
require.pop-schema/user-roles-access-control : unbound version constraints (dev-master) should be avoided
require.pop-schema/user-roles-wp : unbound version constraints (dev-master) should be avoided
require.pop-schema/user-state-wp : unbound version constraints (dev-master) should be avoided
require.pop-schema/usermeta-wp : unbound version constraints (dev-master) should be avoided
require.pop-schema/users-wp : unbound version constraints (dev-master) should be avoided
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com oauth access: OK
Checking disk free space: OK
Checking pubkeys: 
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
Composer version: 1.10.12
PHP version: 7.4.10
PHP binary path: /usr/local/Cellar/php/7.4.10/bin/php
OpenSSL version: OpenSSL 1.1.1g  21 Apr 2020

When I run this command:

composer update

I get the following output:


                                                                                                       
  [RuntimeException]                                                                                   
  Could not load package johnpbloch/wordpress-core in http://repo.packagist.org: [UnexpectedValueExce  
  ption] Could not parse version constraint refs/heads/5.3.x-dev: Invalid version string "refs/heads/  
  5.3.x-dev"                                                                                           
                                                                                                       

                                                                                                       
  [UnexpectedValueException]                                                                           
  Could not parse version constraint refs/heads/5.3.x-dev: Invalid version string "refs/heads/5.3.x-d  
  ev"                                                                                                  
                                                                                                       

And I expected this to happen:

It should work.

Btw, version 1.10.11 also fails, producing a different error:


                                                                                                       
  [RuntimeException]                                                                                   
  Could not load package ezsystems/ezplatform in http://repo.packagist.org: [UnexpectedValueException  
  ] Could not parse version constraint dev-load-varnish-only-when-used as ^2.0@dev: Invalid version s  
  tring "^2.0@dev"                                                                                     
                                                                                                       

                                                                                                       
  [UnexpectedValueException]                                                                           
  Could not parse version constraint dev-load-varnish-only-when-used as ^2.0@dev: Invalid version str  
  ing "^2.0@dev"                                                                                       
                                                                                                       

With version 1.10.10 it works perfectly

@leoloso
Copy link
Sponsor Author

leoloso commented Sep 9, 2020

This is my Travis build, showing the error:

https://travis-ci.com/github/GraphQLAPI/graphql-api-for-wp/jobs/382623875

I had to temporarily do a self-update to 1.10.10 for the build to work again

@terryshi96
Copy link

+1

@GrahamCampbell
Copy link
Contributor

Please try again with 1.10.13.

@Seldaek
Copy link
Member

Seldaek commented Sep 9, 2020

Should be resolved by 1.10.13 yes

@Seldaek Seldaek closed this as completed Sep 9, 2020
@leoloso
Copy link
Sponsor Author

leoloso commented Sep 9, 2020

Yes, fixed 👏

@junowilderness
Copy link

We can reproduce a similar issue on a Drupal module and Composer 1.10.13:

{
    "name": "example/example",
    "type": "project",
    "license": "proprietary",
    "require": {
        "drupal/recaptcha": "^2.4"
       
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        {
            "type": "composer",
            "url": "https://asset-packagist.org"
        }
    ]
}
> composer update

  [RuntimeException]
  Could not load package drupal/recaptcha in https://packages.drupal.org/8: [UnexpectedValueException] Could not parse version constraint dev: Invalid version string "dev"



  [UnexpectedValueException]
  Could not parse version constraint dev: Invalid version string "dev"

@Seldaek
Copy link
Member

Seldaek commented Sep 10, 2020

@cilefen yes I am aware of that, I reached out to the Drupal repo maintainers to get it resolved. Note that as a workaround if you upgrade to Composer 2 RC1 I believe it should not fail anymore, as thanks to the optimizations we did it should not load the affected package version (drupal/recaptcha 2.0.0).

@junowilderness
Copy link

@Seldaek Thank you for the quick reply!

@junowilderness
Copy link

@Seldaek Your message got through. I'm communicating on Slack about it.

...and congratulations on the RC!

@junowilderness
Copy link

FWIW Composer 2.0.0-RC1 produces the same exception ^ on that package.

@Seldaek
Copy link
Member

Seldaek commented Sep 10, 2020

Ok it could be more versions are affected than I thought. I didn't look so in depth. I guess for now if you need the drupal repo you better pin to an older composer version then, 1.10.10 (or 2.0.0-alpha3) should be safe.

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

No branches or pull requests

5 participants