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

Cant install with laravel 8 #6

Open
soncemvo opened this issue Jan 28, 2021 · 20 comments
Open

Cant install with laravel 8 #6

soncemvo opened this issue Jan 28, 2021 · 20 comments

Comments

@soncemvo
Copy link

Laravel 8 now require guzzle 7.0.1 so composer fails:

Problem 1
    - cwhite92/b2-sdk-php[v1.2.0, ..., v1.3.0] require guzzlehttp/guzzle ^6.1 -> found guzzlehttp/guzzle[6.1.0, ..., 6.5.x-dev] but it conflicts with your root composer.json require (^7.0.1).
    - gliterd/backblaze-b2[dev-analysis-qoj29N, dev-analysis-8w1029, 0.0.1, ..., 0.0.3, 1.0.0, ..., 1.1.1] require guzzlehttp/guzzle ^6.1 -> found guzzlehttp/guzzle[6.1.0, ..., 6.5.x-dev] but it conflicts with your root composer.json require (^7.0.1).
    - gliterd/backblaze-b2[dev-feature/refactor, dev-release/1.2.0, dev-analysis-L3oKZl, 1.2.0, ..., 1.3.1] require php ^7.1.8 -> your php version (8.0.1) does not satisfy that requirement.
    - mhetreramesh/flysystem-backblaze[dev-release/1.5.0, dev-analysis-XZbavP, dev-analysis-q5p9Oy, 1.5.0, ..., 1.5.2] require php ^7.1.8 -> your php version (8.0.1) does not satisfy that requirement.
    - gliterd/backblaze-b2[dev-feature/update-dependencies, dev-master, dev-develop, dev-analysis-4xy9PE, 1.4.0, ..., 1.4.2] require php ^7.2 -> your php version (8.0.1) does not satisfy that requirement.
    - bringyourownideas/laravel-backblaze 2.0.0 requires mhetreramesh/flysystem-backblaze * -> satisfiable by mhetreramesh/flysystem-backblaze[dev-feature/Directory_Functions, dev-release/1.5.0, dev-scrutinizer-patch-1, dev-analysis-XZbavP, dev-analysis-q5p9Oy, 1.0.0, ..., 1.5.2].
    - mhetreramesh/flysystem-backblaze[1.1.0, ..., 1.1.4] require gliterd/backblaze-b2 * -> satisfiable by gliterd/backblaze-b2[dev-feature/update-dependencies, dev-feature/refactor, dev-master, dev-release/1.2.0, dev-develop, dev-analysis-L3oKZl, dev-analysis-qoj29N, dev-analysis-4xy9PE, dev-analysis-8w1029, 0.0.1, 0.0.2, 0.0.3, 1.0.0, ..., 1.4.2].
    - mhetreramesh/flysystem-backblaze[dev-feature/Directory_Functions, dev-scrutinizer-patch-1, 1.0.0, ..., 1.0.10] require cwhite92/b2-sdk-php ^1.2 -> satisfiable by cwhite92/b2-sdk-php[v1.2.0, v1.2.1, v1.3.0].
    - Root composer.json requires bringyourownideas/laravel-backblaze ^2.0 -> satisfiable by bringyourownideas/laravel-backblaze[2.0.0].

its not directly your problem, just letting you know

@spekulatius
Copy link
Member

Ah okay, thanks for the heads up!

As I'm doing my first project with Laravel 8 now I'll have to deal with it shortly too.

@spekulatius
Copy link
Member

The dependency isn't looking overly active: https://github.com/cwhite92/b2-sdk-php

This one https://github.com/zaxbux/b2-sdk-php might be worthy to look into - he might be more interested in adding guzzle 7 support

@slakbal
Copy link

slakbal commented Jan 28, 2021

Tip: From Laravel 8 if you use the built in http client then the Guzzle dependency can be dropped? Ah but I see that it is a dependency of a dependency.

This package has already Guzzle7 support: https://github.com/obregonco/backblaze-b2 maybe a good choice also.

@spekulatius
Copy link
Member

Yeah, guzzle is a dependency of a dependency. I got to check if https://github.com/obregonco/backblaze-b2 works - looks promising

@slakbal
Copy link

slakbal commented Jan 28, 2021

Hmmmm, though I'd share this with you. Just tried something and it works like a charm. Since Backblaze says it has a S3 compatible storage API, I tried the following on the latest Laravel 8 with php8:

"league/flysystem-aws-s3-v3": "~1.0"

  • Then in my .env file added the following:

AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxxxxxxxx
AWS_SECRET_ACCESS_KEY=yyyyyyyyyyyyyyyyyyyyyy
AWS_DEFAULT_REGION=eu-central-003
AWS_BUCKET=TestBucket
AWS_ENDPOINT=https://s3.eu-central-003.backblazeb2.com

Note that I've added the "AWS_ENDPOINT" variable to the existing .env settings for AWS. All of the above mentioned information can be retrieved when creating a bucket and API key on backblaze's site.

  • And then just use s3 as a disk e.g.:

Storage::disk('s3')->put('test-upload/test.txt', $contents)

And BOOM it works! Just like as if you are using S3. I just figured if they say it is an S3 compatible API, then S3 adaptors should work.

Might not be optimal for all use-cases but for working with Laravel's storage and disks it seems to be honky dorky!

@soncemvo
Copy link
Author

soncemvo commented Jan 28, 2021

Not working for me, always got ACL error
Error executing "PutObject" on "https://***.s3.us-west-002.backblazeb2.com/testb2-new.txt"; AWS HTTP error: Client error: PUT https://***.s3.us-west-002.backblazeb2.com/testb2-new.txtresulted in a400 Bad Request response: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Error> <Code>InvalidArgument</Code> <Message>Unsupporte (truncated...) InvalidArgument (client): Unsupported value for canned acl 'private' - <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Error> <Code>InvalidArgument</Code> <Message>Unsupported value for canned acl 'private'</Message> </Error>

so i compile all abandoned repos in single one, and fix some files for guzzle 7

@soncemvo
Copy link
Author

https://github.com/obregonco/backblaze-b2

there is some problems with this repo too

@spekulatius
Copy link
Member

Hmmmm, though I'd share this with you. Just tried something and it works like a charm. Since Backblaze says it has a S3 compatible storage API, I tried the following on the latest Laravel 8 with php8:

* Installed the Laravel recommended driver: https://laravel.com/docs/8.x/filesystem#composer-packages

* In my composer file I added the following dependency:

"league/flysystem-aws-s3-v3":

* Then in my .env file added the following:

AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxxxxxxxx
AWS_SECRET_ACCESS_KEY=yyyyyyyyyyyyyyyyyyyyyy
AWS_DEFAULT_REGION=eu-central-003
AWS_BUCKET=TestBucket
AWS_ENDPOINT=https://s3.eu-central-003.backblazeb2.com

Note that I've added the "AWS_ENDPOINT" variable to the existing .env settings for AWS. All of the above mentioned information can be retrieved when creating a bucket and API key on backblaze's site.

* And then just use s3 as a disk e.g.:

Storage::disk('s3')->put('test-upload/test.txt', $contents)

And BOOM it works! Just like as if you are using S3. I just figured if they say it is an S3 compatible API, then S3 adaptors should work.

Might not be optimal for all use-cases but for working with Laravel's storage and disks it seems to be honky dorky!

That's a good point - at the end B2 should be compatible. I'll try this out for my project and let you know if it works for me.

@soncemvo
Copy link
Author

s3 compatible api works only with master keys, as far as i know

@spekulatius
Copy link
Member

Yeah, same for the current package - the application keys never worked.

@soncemvo
Copy link
Author

u can use my repo if u want. i made application keys works here https://github.com/soncemvo/laravel-b2

@spekulatius
Copy link
Member

u can use my repo if u want. i made application keys works here https://github.com/soncemvo/laravel-b2

to achieve what exactly? I was thinking of going with the S3-compatible approach by @slakbal

@slakbal
Copy link

slakbal commented Jan 29, 2021

@soncemvo @spekulatius I see I forgot to include the version on my composer entry. Updated my previous comment to include the following, but also included the full composer dependencies. As mentioned latest Laravel 8 and php8.

{
        "php": "^7.3|^8.0",
        "fideloper/proxy": "^4.4",
        "fruitcake/laravel-cors": "^2.0",
        "guzzlehttp/guzzle": "^7.0.1",
        "laravel/framework": "^8.12",
        "laravel/tinker": "^2.5",
        "league/flysystem-aws-s3-v3": "~1.0"
}

See docs: https://laravel.com/docs/8.x/filesystem#composer-packages

  • the config is with "Application Keys" and NOT "Master Keys". Make sure you give the application key all permissions for the respective bucket when creating it.
  • AWS_DEFAULT_REGION=eu-central-003 ..... (My region is eu-central-003, which I extracted from the endpoint for the bucket for which the Application Key was generated: s3. eu-central-003 .backblazeb2.com Make sure you use the full value after s3. and up to .backblazeb2.com.
  • AWS_ENDPOINT=https://s3.eu-central-003.backblazeb2.com ..... and add https:// to the end-point value.
  • AWS_BUCKET=TestBucket .... make sure the name is exactly the same as the name of the BackBlaze bucket.

https://www.backblaze.com/b2/docs/s3_compatible_api.html

Hope it's helps.

@spekulatius
Copy link
Member

Awesome, thank you @slakbal! I'll try it out over the weekend and let you know if I got it working

@soncemvo
Copy link
Author

soncemvo commented Jan 29, 2021

@slakbal still no success with s3
image
image

and this is full public bucket with all rights

@slakbal
Copy link

slakbal commented Feb 3, 2021

@soncemvo don't know what to tell you. I don't have access to your code so cant help you. I'll see if I can upload for you a quick project when I get some time. But let's also hear from @spekulatius if he was able to try it out also.

@spekulatius
Copy link
Member

Hey @slakbal

I've tested the s3-compatiblity and it works like a charm. Much easier - thanks for hinting to this. I think it makes more sense to suggest this approach instead of maintaining another package.

Cheers,
Peter

@spekulatius
Copy link
Member

Hey @slakbal

did you notice any issues while cleaning up backups? I seem to have the old backups remaining and an empty file being added?

Cheers,
Peter

@uvham521
Copy link

I also met the same problem and found a solution.
In the filesystem.php configuation file, add an options item, and set the value of the ACL to an empty string.

's3' => [
    'driver'                  => 's3',
    'key'                     => env('AWS_ACCESS_KEY_ID'),
    'secret'                  => env('AWS_SECRET_ACCESS_KEY'),
    'region'                  => env('AWS_DEFAULT_REGION'),
    'bucket'                  => env('AWS_BUCKET'),
    'url'                     => env('AWS_URL'),
    'endpoint'                => env('AWS_ENDPOINT'),
    'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
    'options'                 => [
        'ACL' => '',
    ]
],

@spekulatius
Copy link
Member

Hello @hui-ho,

I've tried the settings but my old backups still won't get cleaned up. Any idea why?

Cheers,
Peter

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

4 participants