statamic / cms

The core Laravel CMS Composer package
https://statamic.com
Other
4.08k stars 533 forks source link

Fails to deploy with composer 2.7.3 because of dependency #9945

Closed ajnsn closed 6 months ago

ajnsn commented 6 months ago

Bug description

Deploying Statamic

In Application.php line 403:

[Error]                                                                          
Call to undefined method Composer\Util\Http\ProxyManager::needsTransitionWarning()  

How to reproduce

Composer 2.7.3, works with 2.7.2

"fyi"

See https://github.com/composer/composer/issues/11940

Can be fixed by removing the composer/composer dependecy, see comment

Logs

No response

Environment

Environment
Application Name: 
Laravel Version: 10.48.3
PHP Version: 8.2.6
Composer Version: 2.7.2
Environment: staging
Debug Mode: OFF
URL: 
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: NOT CACHED

Drivers
Broadcasting: log
Cache: redis
Database: mysql
Logs: daily
Mail: smtp
Queue: redis
Session: database

Livewire
Livewire: v3.4.9

Sentry
Enabled: YES
Environment: staging
Laravel SDK Version: 3.8.2
PHP SDK Version: 3.22.1
Release: NOT SET
Sample Rate Errors: 100%
Sample Rate Performance Monitoring: 0%
Sample Rate Profiling: NOT SET
Send Default PII: DISABLED

Statamic
Addons: 0
Antlers: runtime
Sites: 1
Stache Watcher: Disabled
Static Caching: Disabled
Version: 4.53.2 PRO

Installation

Existing Laravel app

Antlers Parser

None

Additional details

No response

duncanmcclean commented 6 months ago

We do actually use the composer/composer dependency in various places.

There's an open PR on the Composer side which looks like it may fix this, see https://github.com/composer/composer/pull/11943.

ajnsn commented 6 months ago

Thanks for your fast feedback.

I just had the error in Laravel Forge today - without changing anything. Just a new deploy. Yesterday it was still working.

There will probably be a lot of Statamic devs who will run into this error soon. At least we now have a own issue about it.

duncanmcclean commented 6 months ago

There's been some discussion about this issue on the Discord. Someone has shared a workaround:

It seems to also get fixed by removing the composer/composer package itself in /vendor and updating/reinstalling the package. This way I didn't have to downgrade composer globally.

rm -rf vendor/composer/composer && composer update composer/composer

ajnsn commented 6 months ago

It seems to also get fixed by removing the composer/composer package itself in /vendor and updating/reinstalling the package. This way I didn't have to downgrade composer globally.

rm -rf vendor/composer/composer && composer update composer/composer

Thanks. I can confirm this works.

hivokas commented 6 months ago

It seems to also get fixed by removing the composer/composer package itself in /vendor and updating/reinstalling the package. This way I didn't have to downgrade composer globally.

rm -rf vendor/composer/composer && composer update composer/composer

Thanks, it fixed the problem for me!

Seldaek commented 6 months ago

Composer 2.7.4 is now out which hopefully fixes it.

duncanmcclean commented 6 months ago

Thanks @Seldaek!

Seldaek commented 6 months ago

@duncanmcclean that said.. Please don't just shove this under the rug.

We do actually use the composer/composer dependency in various places.

Are you sure? I just found 4 usages:

https://github.com/search?q=repo%3Astatamic%2Fcms+"use+composer"&type=code

The first the script one definitely doesn't need composer/composer as that is code that will be executed by Composer itself where the class exists.

The other 3 using version parser should just require composer/semver.

If I missed something I'm happy to take a closer look.

jasonvarga commented 6 months ago

We may have required composer/composer intentionally at one point, but it looks like you're right that we could get away with just requiring semver now. Thanks!

We appreciate you chiming in here @Seldaek. Wasn't expecting that, especially on your vacation. Go try to enjoy it! 🏝️