Closed heytrav closed 5 years ago
I would make sure that your s3 client is actually using your key and secret. If this isn't a global environment variable on your machine and just in your .env file you have to configure the s3 client in your yaml config. Checkout https://github.com/silverstripe/silverstripe-s3/issues/26#issuecomment-505525388 for an example.
I guess this is the confusing thing for us (I work with @heytrav), I'd expect the module to pickup the ENV var, from .env itself. So on first glance, it seems redundant to have to re-state the config in YML. Regardless, it works from my dev env, when previously it didn't.
The module was designed primarily to work on amazon infrastructure directly, so you wouldn't be specifying anything other than the region and your bucket name. The reason you have to setup the yml config is that the s3 client class that is used is injected dynamically with SS Injector class from the yaml config.
If we set it up the default config to always look for the key and secret then it wouldn't work on amazon directly as the key and secret aren't in their default environment.
Checkout - https://github.com/silverstripe/silverstripe-s3/blob/master/_config/assets.yml#L8 to see how we instantiate the AWS PHP SDK's s3 client. You are basically telling the injector to use different constraints on the constructor of the clients instantiation.
Attempts to upload images via the SilverStripe GUI always fail with a 403 error when attempting to upload the objects to my s3 bucket.
Expected Result
File is uploaded and appears in my s3 bucket
Actual result
Config
In my .env file:
My S3 policy:
If I try to upload objects using the aws command line interface it works fine:
Any suggestions what I am doing wrong would be highly appreciated.