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

Generation of transforms happening, but produces error. #6

Closed
laneige1990 opened this issue Sep 25, 2024 · 3 comments
Closed

Generation of transforms happening, but produces error. #6

laneige1990 opened this issue Sep 25, 2024 · 3 comments

Comments

@laneige1990
Copy link

laneige1990 commented Sep 25, 2024

Similarly to this issue that is still open, we are using DO spaces and Imager X. However, that error seems to surround the existence of optimisers (which in our case are there and seem to be creating the transform files). However, we are getting the following error when generating the transforms:

2024-09-25 11:11:40 [queue.ERROR] [craft\queue\QueueLogBehavior::afterError] [2344] Optimizing images (optipng) (attempt: 1, pid: 113479) - Error (time: 0.105s): Found 1 error while validating the input provided for the PutObject operation: [Body] must be an fopen resource, a GuzzleHttp\Stream\StreamInterface object, or something that can be cast to a string. Found bool(false) {"memory":39171856}

The error seems to also happen with jpegtran as well. Below is the stack trace.

Stack Trace:

2024-09-25 11:11:40 [queue.ERROR] [InvalidArgumentException] Found 1 error while validating the input provided for the PutObject operation: [Body] must be an fopen resource, a GuzzleHttp\Stream\StreamInterface object, or something that can be cast to a string. Found bool(false) {"trace":["#0 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/aws/aws-sdk-php/src/Middleware.php(85): Aws\\Api\\Validator->validate()","
#1 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/aws/aws-sdk-php/src/S3/S3Client.php(631): Aws\\Middleware::Aws\\{closure}()","
#2 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/aws/aws-sdk-php/src/S3/S3Client.php(654): Aws\\S3\\S3Client::Aws\\S3\\{closure}()","
#3 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/aws/aws-sdk-php/src/S3/S3Client.php(588): Aws\\S3\\S3Client::Aws\\S3\\{closure}()","
#4 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/aws/aws-sdk-php/src/S3/S3Client.php(607): Aws\\S3\\S3Client::Aws\\S3\\{closure}()","
#5 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/aws/aws-sdk-php/src/Middleware.php(58): Aws\\S3\\S3Client::Aws\\S3\\{closure}()","
#6 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/aws/aws-sdk-php/src/S3/SSECMiddleware.php(59): Aws\\Middleware::Aws\\{closure}()","
#7 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/aws/aws-sdk-php/src/IdempotencyTokenMiddleware.php(77): Aws\\S3\\SSECMiddleware->__invoke()","
#8 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/aws/aws-sdk-php/src/AwsClientTrait.php(64): Aws\\IdempotencyTokenMiddleware->__invoke()","
#9 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/aws/aws-sdk-php/src/AwsClientTrait.php(58): Aws\\AwsClient->executeAsync()","
#10 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/aws/aws-sdk-php/src/AwsClientTrait.php(86): Aws\\AwsClient->execute()","
#11 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/spacecatninja/imager-x-do-spaces-driver/src/externalstorage/DOSpacesStorage.php(78): Aws\\AwsClient->__call()","
#12 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/spacecatninja/imager-x/src/services/StorageService.php(52): spacecatninja\\imagerxdospacesdriver\\externalstorage\\DOSpacesStorage::upload()","
#13 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/spacecatninja/imager-x/src/jobs/OptimizeJob.php(69): spacecatninja\\imagerx\\services\\StorageService->store()","
#14 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/yiisoft/yii2-queue/src/Queue.php(243): spacecatninja\\imagerx\\jobs\\OptimizeJob->execute()","
#15 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/yiisoft/yii2-queue/src/cli/Queue.php(162): yii\\queue\\Queue->handleMessage()","
#16 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/yiisoft/yii2-queue/src/cli/Command.php(146): yii\\queue\\cli\\Queue->execute()","
#17 [internal function]: yii\\queue\\cli\\Command->actionExec()","
#18 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()","
#19 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/yiisoft/yii2/base/Controller.php(178): yii\\base\\InlineAction->runWithParams()","
#20 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/yiisoft/yii2/console/Controller.php(180): yii\\base\\Controller->runAction()","
#21 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/craftcms/cms/src/console/ControllerTrait.php(89): yii\\console\\Controller->runAction()","
#22 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/yiisoft/yii2/base/Module.php(552): craft\\queue\\Command->runAction()","
#23 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/yiisoft/yii2/console/Application.php(180): yii\\base\\Module->runAction()","
#24 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/craftcms/cms/src/console/Application.php(91): yii\\console\\Application->runAction()","
#25 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/yiisoft/yii2/console/Application.php(147): craft\\console\\Application->runAction()","
#26 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/craftcms/cms/src/console/Application.php(122): yii\\console\\Application->handleRequest()","
#27 /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/yiisoft/yii2/base/Application.php(384): craft\\console\\Application->handleRequest()","
#28 /home/forge/ournameismud-staging.mudbank.uk/deploy/craft(13): yii\\base\\Application->run()","
#29 {main}"],"memory":39172072,"exception":"[object] (InvalidArgumentException(code: 0): Found 1 error while validating the input provided for the PutObject operation:\n[Body] must be an fopen resource, a GuzzleHttp\\Stream\\StreamInterface object, or something that can be cast to a string. Found bool(false) at /home/forge/ournameismud-staging.mudbank.uk/deploy/vendor/aws/aws-sdk-php/src/Api/Validator.php:65)"} 

So, I have ensured the optimisers are installed correctly and they seem to work if used from the CLI. However, I still seem to be getting this error. I have tracked it down to the AWS S3 library which is being used by the DO adapter which is missing something.

Funnily enough however, if I switch the imager-x.php config to instead include optimizeType => 'runtime' It seems to completely fix the error (The error does not seem to show in the web log when doing this either). (Turns out is still still failing when using it under 'runtime' as well.)

@laneigemud1990
Copy link

Any thoughts on this?

@laneigemud1990
Copy link

Issue solved - Was our end, we had the web root incorrectly set in the imager-x.php config.

@aelvan
Copy link
Contributor

aelvan commented Oct 2, 2024

Sorry, I was on vacation, great that you figured it out!

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

3 participants