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

AWS S3 Region Missing #241

Open
2 tasks
pimago opened this issue Oct 2, 2023 · 6 comments
Open
2 tasks

AWS S3 Region Missing #241

pimago opened this issue Oct 2, 2023 · 6 comments

Comments

@pimago
Copy link

pimago commented Oct 2, 2023

I'm submitting a...

  • bug report
  • feature request
  • [x ] general question

Description

I am gettin these missing region errors when I try to transform images from S3.
The default craft transforms are working fine.

Displayed errors, stack trace, relevant logs

A "region" configuration value is required for the "s3" service
(e.g., "us-west-2"). A list of available public regions and endpoints can be
found at http://docs.aws.amazon.com/general/latest/gr/rande.html. {"memory":7425008} 
2023-10-02 12:01:27 [web.ERROR] [spacecatninja\imagerx\services\StorageService::store] An error occured when trying to upload file "/var/www/html/web/imager/images/3028/dealerofdecaythumb-Kopie-2_398ca7b8debe49bfbe7d47514c01e3d7.webp" to external storage "aws". The transformed file has been deleted. {"memory":7391000} 
2023-10-02 12:01:27 [web.ERROR] [spacecatninja\imagerx\externalstorage\AwsStorage::upload] Invalid configuration of S3 Client: Missing required client configuration options:

my aws config for imager

'storageConfig' => [
        'aws' => [
            'accessKey' => App::env('S3_KEY_ID'),
            'secretAccessKey' => App::env('S3_SECRET'),
            'region' => App::env('S3_REGION'),
            'bucket' => App::env('S3_BUCKET'),
            'folder' => 'imager',
            'requestHeaders' => array(),
            'storageType' => 'standard',
            'public' => false,
            'cloudfrontInvalidateEnabled' => true,
            'cloudfrontDistributionId' => App::env('CLOUDFRONT_DISTRIBUTION_ID'),
        ]
    ]

Region is eu-central-1

Additional info

@aelvan
Copy link
Contributor

aelvan commented Oct 2, 2023

Hi,

Have you double checked that eu-central-1 is in fact where the bucket is located? A common mistake is to mix the region that the AWS console is using with the region of the bucket. Ie, check the list of buckets for your account, and check what the region column says.

If that checks out, make sure the (correct) env var is set, and check that that's in fact what ends up in your config file (doing die(App::env('S3_REGION')) inside the config file is the quick and dirty way to do that).

If both of those seems ok, let me know and I'll look into if something in AWS has changed recently that I need to look at. A quick test shows that the S3 integration still works in my test environment, so it's either a config- or environment-specific thing.

@pimago
Copy link
Author

pimago commented Oct 2, 2023

Hi André, yes that's the bucket region.
In the bucket properties it says:
Bucket overview
AWS Region Europe (Frankfurt) eu-central-1

The env var is correct it returns eu-central-1. Craft itself is handling the S3 upload fine.
Probably I am overlooking something else.

@aelvan
Copy link
Contributor

aelvan commented Oct 4, 2023

Ok, I'll try to set up a new bucket based on Andrew´s setup and see if I can reproduce.

@aelvan
Copy link
Contributor

aelvan commented Oct 11, 2023

Hi,

I've tested again, setting up a brand new AWS setup using Andrew's tutorial, and everything works as expected.

I've tried provoking the error you're seeing, and the only way to get that exact error, is if region is an empty string, ''. If it has any value at all, or null, you'll get other errors. So I'll have to conclude that the env var is not working, or something happens to that value on the way through Imager's code, which seems unlikely. Have you tried hardcoding the value for region as a test, ie 'region' => 'eu-central-1'?

@pimago
Copy link
Author

pimago commented Oct 13, 2023

I did try that. Somehow the error log for the missing region is gone in general. But I am still not seeing any image. Maybe there is something with my S3 setting. When I open the broken image I get an access denied xml file.

@pimago
Copy link
Author

pimago commented Oct 14, 2023

I checked the debug toolbar.
The region error is back. I don't know why it was gone yesterday. The region is still hardcoded.
But there is also another error:

An error occured when trying to upload file "/var/www/html/web/imager/images/3028/dealerofdecaythumb-Kopie-2_398ca7b8debe49bfbe7d47514c01e3d7.webp" to external storage "aws". The transformed file has been deleted.

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