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

undefined method named "of" of class "GuzzleHttp\Promise\Coroutine" #130

Closed
keulinho opened this issue Oct 2, 2020 · 4 comments
Closed

Comments

@keulinho
Copy link

keulinho commented Oct 2, 2020

PHP version: 7.4.10

Description
After updating to guzzle 1.4.0 there occurs an error that the mehtod Coroutine::of() method cannot be found.

Attempted to call an undefined method named "of" of class "GuzzleHttp\Promise\Coroutine".

How to reproduce
Seems like an issue when using the coroutine() function. See stacktrace below.

Additional context
This issue occured in combination with using flysystem & the aws s3 adapter of flysystem.
The error occured when Filesystem::deleteDir() was called.

Full stacktrace:

Exception trace:
  at /var/www/html/vendor/guzzlehttp/promises/src/functions.php:362
 GuzzleHttp\Promise\coroutine() at /var/www/html/vendor/aws/aws-sdk-php/src/S3/BatchDelete.php:109
 Aws\S3\BatchDelete::Aws\S3\{closure}() at n/a:n/a
 call_user_func() at /var/www/html/vendor/aws/aws-sdk-php/src/S3/BatchDelete.php:217
 Aws\S3\BatchDelete->createPromise() at /var/www/html/vendor/aws/aws-sdk-php/src/S3/BatchDelete.php:118
 Aws\S3\BatchDelete->promise() at /var/www/html/vendor/aws/aws-sdk-php/src/S3/S3ClientTrait.php:139
 Aws\S3\S3Client->deleteMatchingObjectsAsync() at /var/www/html/vendor/aws/aws-sdk-php/src/S3/S3ClientTrait.php:110
 Aws\S3\S3Client->deleteMatchingObjects() at /var/www/html/vendor/league/flysystem-aws-s3-v3/src/AwsS3Adapter.php:202
 League\Flysystem\AwsS3v3\AwsS3Adapter->deleteDir() at /var/www/html/vendor/league/flysystem/src/Filesystem.php:251
 League\Flysystem\Filesystem->deleteDir() at /var/www/html/vendor/shopware/storefront/Theme/ThemeCompiler.php:110
@GrahamCampbell
Copy link
Member

Looks like you need to restart php-fpm because you have a stale cache of the Coroutine.php file. Either that, or you need to delete you vendor folder and composer cache, and run composer update.

@keulinho
Copy link
Author

keulinho commented Oct 2, 2020

We have immutable infrastructure and build the whole container anew for each update, including the composer dependencies.
Meaning restarting php-fpm or running composer update should not have any affect as we do a clean composer install each time.

The logs from composer update clearly state that it installed v1.4.0:

  - Downloading guzzlehttp/psr7 (1.7.0)
  - Downloading guzzlehttp/promises (1.4.0)
  - Downloading guzzlehttp/guzzle (6.5.2)

The thing that confuses me most is that functions.php has to be up2date as it tries to make the "new" call to the Coroutine::of() method, but the loaded Coroutine class, that should be loaded from the same folder/namespace seems to be an old version that does not have the of() method. 🤔

@keulinho keulinho closed this as completed Oct 2, 2020
@keulinho keulinho reopened this Oct 2, 2020
@GrahamCampbell
Copy link
Member

GrahamCampbell commented Oct 2, 2020

That indicates there is not a bug here, just that your vendor folder didn't get updated properly. Delete you composer cache directory as well as the vendor folder. The 1.4.0 zip definitely has the correct files in it: https://github.com/guzzle/promises/archive/1.4.0.zip.

@keulinho
Copy link
Author

keulinho commented Oct 2, 2020

After quite some debugging we found the source for this problems. The Coroutine class was autoloaded from another vendor folder than the functions file.

But thank you for your fast replies & your support.

@keulinho keulinho closed this as completed Oct 2, 2020
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

2 participants