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

Cannot Install league/flysystem-aws-s3-v3 #4439

Closed
Ipstenu opened this issue Dec 20, 2024 · 4 comments
Closed

Cannot Install league/flysystem-aws-s3-v3 #4439

Ipstenu opened this issue Dec 20, 2024 · 4 comments

Comments

@Ipstenu
Copy link

Ipstenu commented Dec 20, 2024

PHP version: 8.3.6
FreeScout version: 1.8.160
Database: MySQL
Are you using CloudFlare: Yes
Are you using non-official modules: No

I was attempting to install AWS S3 for storage and I read the FAQ: https://github.com/freescout-help-desk/freescout/wiki/FAQ#how-can-attachments-be-stored-in-amazon-aws-s3

Per the laravel directions I ran composer require league/flysystem-aws-s3-v3 ~1.0 --ignore-platform-req=php (per https://github.com/freescout-help-desk/freescout/wiki/Development-Guide#github-workflow ) and everything seemed to work until I ran php /var/www/html/artisan freescout:clear-cache

Error occurred saving /storage/app/public/js/vars.js. Error: Implicit conversion from float 64917.10999989664 to int loses precision; File: /var/www/html/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php (143)

Now at first I thought it was related to a known issue in AWS ( guzzle/guzzle#3071 ) but when I ran composer why guzzlehttp/guzzle, I hit this:

aws/aws-sdk-php              3.336.1 requires                   guzzlehttp/guzzle (^6.5.8 || ^7.4.5)
codedge/laravel-selfupdater  1.4.3   requires                   guzzlehttp/guzzle (6.*)

And the problem here is that if you update laravel-selfupdater to the version that supports Guzzle 7? laravel/framework 8.

We're on 5.5. (I fully understand (and support!) the no-upgrade policy with regards to the framework.)

This made an endless circle of a headache for me.

  1. Connecting to the modern AWS API requires at least v3 of the SDK library
  2. AWS SDK v3 requires Guzzle 7
  3. Guzzle 7 is not compatible with laravel 5

It won't matter if I switch to PHP 7.4, since I would still have to use the modern AWS library to connect to the API without errors. I have zero control over that API 😞

So my question here is ... is 8 completely out of the question? I don't like needlessly updating the framework, but it's prohibiting connectivity with the AWS API (and the DigitalOcean one as well for anyone who tried that).

Alternatively does anyone have a workaround for this?

ETA:

Here's the error you'll get on PHP 7.4 when you try to flush the cache:

Error occurred saving /storage/app/public/js/vars.js. Error: This installation of the SDK is using PHP version 7.4.3-4ubuntu2.28, which will be deprecated on January 13th, 2025.
Please upgrade your PHP version to a minimum of 8.1.x to continue receiving updates for the AWS SDK for PHP.
To disable this warning, set suppress_php_deprecation_warning to true on the client constructor or set the environment variable AWS_SUPPRESS_PHP_DEPRECATION_WARNING to true.
More information can be found at: https://aws.amazon.com/blogs/developer/announcing-the-end-of-support-for-php-runtimes-8-0-x-and-below-in-the-aws-sdk-for-php/
; File: /var/www/html/vendor/aws/aws-sdk-php/src/ClientResolver.php (1409)
@freescout-help
Copy link
Collaborator

is 8 completely out of the question?

Yep.

vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php has been overridden and the issue has been fixed in the master branch and will be published in the next release.

@Ipstenu
Copy link
Author

Ipstenu commented Dec 22, 2024

Hey that’s awesome! Thank you!

as a separate ask (so I know if I should make a pr or not), are you opposed to adding in parameter or two to Filesystems.php? I found out Digital Ocean and AWS are slightly different and need a separate parameter. I’m writing it up for work, and I’m happy to share the docs as well (like how to link the folder and all)

@freescout-help
Copy link
Collaborator

adding in parameter or two to Filesystems.php

It's not quite clear what parameter you are talking about. And do you mean config/filesystems.php file?

@Ipstenu
Copy link
Author

Ipstenu commented Dec 23, 2024

That’s the file.

I had to change the s3 section to this:

         // To store on S3, altered for DigitalOcean Spaces
        's3' => [
            'driver'                  => 's3',
            'key'                     => env('AWS_ACCESS_KEY_ID'),
            'secret'                  => env('AWS_SECRET_ACCESS_KEY'),
            'region'                  => env('AWS_DEFAULT_REGION'),
            'bucket'                  => env('AWS_BUCKET'),
            'endpoint'                => env('AWS_ENDPOINT'),
            'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', true),
        ],

adding in endpoint and use_path_style_endpoint (the latter with the default of true for aws) was the other secret sauce to getting DigitalOcean to work without grief.

I imagine it would also work for anyone using a non standard endpoint.

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