Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

theUnforgiven's avatar

Flysystem S3

I'm getting the following error when trying to upload stuff to my S3 bucket

[Aws\S3\Exception\S3Exception]
  The unspecified location constraint is incompatible for the region specific endpoint this request was sent to.

In my filesystems.php config file I have:

's3' => [
            'driver' => 's3',
            'key'    => 'xxxxxxxxxxxxxxxxxxxxxxxxxx',
            'secret' => 'xxxxxxxxxxxxxx',
            'region' => 'eu-west-1',
            'bucket' => 'backups',
        ],

But it doesn't any ideas

0 likes
44 replies
RayRutjes's avatar

Can you show us your actual implementation that triggers the S3 disk? By the way, I doubt you own the 'backups' bucket, have you created that one in your account? Because buckets must have a unique name across the whole aws platform.

theUnforgiven's avatar

Yes it's actually called crmple-backups. it seems to be a problem with the region setting

and I'm using this package as part of it https://github.com/freekmurze/laravel-backup/tree/master

I have these installed via composer too:

"spatie/laravel-backup": "^2.4",
        "league/flysystem-aws-s3-v2": "^1.0"

But like I said seems to be a region problem

jimmck's avatar

Go here in your install .../vendor... and edit config.php with your settings

Jamess-MacBook-Pro:config jimm$ ls -a
.       ..      config.php
Jamess-MacBook-Pro:config jimm$ pwd
/Users/jimm/GitHub/laravel5/vendor/aws/aws-sdk-php-laravel/config
Jamess-MacBook-Pro:config jimm$
jimmck's avatar

did you edit config.php? I assume by your flag you are euro region?

jimmck's avatar

I see us-west region is that where you run out of? I see your other config too. Under l4 I had a seperate config file. I could not get it to work until I updated the config.php I pointed you to. I asm doing that for now. do you have a AWS vendor install config dir and file?

jimmck's avatar

I am running l5. can you just edit the config.php?

theUnforgiven's avatar

how would I edit config thought that what the filesystem.php config file is for. If i do it locally in the vendor dir then I have to do it on Forge too.

getting the following error now

Start backing up
Database dumped
Start zipping 1 files...
Zip created!
Start uploading backup to s3-filesystem...


                                                                                                                                                                         
  [Aws\Common\Exception\TransferException]                                                                                                                               
  [curl] 6: Could not resolve host: crmple-backups.s3.s3-eu-west-1.amazonaws.com.amazonaws.com [url] https://crmple-backups.s3.s3-eu-west-1.amazonaws.com.amazonaws.com  
                                                                                                                                                                         




                                                                                                                                                                         
  [Guzzle\Http\Exception\CurlException]                                                                                                                                  
  [curl] 6: Could not resolve host: crmple-backups.s3.s3-eu-west-1.amazonaws.com.amazonaws.com [url] https://crmple-backups.s3.s3-eu-west-1.amazonaws.com.amazonaws.com
jimmck's avatar

its munging your two hostnames together. can show me your composer.json entries for aws? and a link to your backup system docs? As I said under l4 I was able to name and put my config file where it suited me. When I updated to L5 it was always going to the config.php in vendor ... dir. I just leave at that for now. Can you point backup software there?

jimmck's avatar

ok thanks.. reading now... best way to learn the ins/outs of this package..

RayRutjes's avatar

Forget about configuration and totally forget about the bad practise of modifying stuff in vendor... Have you checked that the credentials you put in your configuration have access to the bucket in read & write?

You can check the permissions in the top right of your bucket. You could give everyone access in read & write for a few minutes to see if that is the problem.

jimmck's avatar

great idea give everyone read/write access. They will pay your storage and cpu bills. I am outta here!

1 like
RayRutjes's avatar

I am running out of ideas here, have you published the configuration files of the backup package?

theUnforgiven's avatar

Yes and set everything up as per the docs. So i have no idea.

RayRutjes's avatar

The curl message states that it can not reach the host: Could not resolve host So maybe your working in an environment that does not allow you to access aws server?

theUnforgiven's avatar

this is what happens on forge


Start backing up
Database dumped
Start zipping 1 files...
Zip created!
Start uploading backup to s3-filesystem...


                                                                                                                                                                         
  [Aws\Common\Exception\TransferException]                                                                                                                               
  [curl] 6: Could not resolve host: crmple-backups.s3.s3-eu-west-1.amazonaws.com.amazonaws.com [url] https://crmple-backups.s3.s3-eu-west-1.amazonaws.com.amazonaws.com  
                                                                                                                                                                         




                                                                                                                                                                         
  [Guzzle\Http\Exception\CurlException]                                                                                                                                  
  [curl] 6: Could not resolve host: crmple-backups.s3.s3-eu-west-1.amazonaws.com.amazonaws.com [url] https://crmple-backups.s3.s3-eu-west-1.amazonaws.com.amazonaws.com  
                                                               
RayRutjes's avatar

By the way the url is wrong: .amazonaws.com.amazonaws.com ? .amazonaws.com Should be mentioned once

theUnforgiven's avatar

i dont know how and why it's twice

which would answer why this error is now on

 [Aws\S3\Exception\S3Exception]                                                                                  
  The unspecified location constraint is incompatible for the region specific endpoint this request was sent to.  
            
RayRutjes's avatar

This clearly states that the region the request was sent to is not correct.

Next

Please or to participate in this conversation.