I've been trying to set up Amazon S3 integration with my Symfony-Sylius app, but I'm facing an issue where the app continues to upload images to the default storage instead of Amazon S3. Upon checking the request coming from the images, I noticed that the URL points to 127.0.0.1:8000
, while my MinIO server is running on 127.0.0.1:9000
. I suspect that the problem lies with Sylius, but I'm not entirely sure how to proceed.
Here's the relevant part of my services.yaml file:
parameters:
amazon.s3.key: "%env(AWS_S3_KEY)%"
amazon.s3.secret: "%env(AWS_S3_SECRET)%"
amazon.s3.bucket: "%env(AWS_S3_BUCKET)%"
amazon.s3.region: "%env(AWS_S3_REGION)%"
amazon.s3.endpoint: "%env(AWS_S3_ENDPOINT)%"
amazon.s3.version: "%env(AWS_S3_VERSION)%"
services:
acme.amazon_s3:
class: Aws\S3\S3Client
factory: [Aws\S3\S3Client, factory]
arguments:
-
credentials: { key: "%amazon.s3.key%", secret: "%amazon.s3.secret%" }
region: "%amazon.s3.region%"
version: "%amazon.s3.version%"
acme.imagine.cache.resolver.aws_s3_resolver:
class: Liip\ImagineBundle\Imagine\Cache\Resolver\AwsS3Resolver
arguments:
- "@acme.amazon_s3"
- "%amazon.s3.bucket%"
tags:
- { name: "liip_imagine.cache.resolver", resolver: "aws_s3_resolver" }
And here's my liip_imagine.yaml configuration:
liip_imagine:
resolvers:
aws_s3_resolver:
aws_s3:
client_config:
credentials:
key: "%amazon.s3.key%"
secret: "%amazon.s3.secret%"
region: "%amazon.s3.region%"
version: "%amazon.s3.version%"
bucket: "%amazon.s3.bucket%"
get_options:
Scheme: http
put_options:
CacheControl: "max-age=86400"
filter_sets:
cache: ~
runtime:
quality: 90
thumb:
quality: 75
filters:
thumbnail: { size: [ 150, 150 ], mode: outbound }
cache: aws_s3_resolver
I am using:
- PHP version 7.4
- AWS SDK for PHP version 3.277
- Sylius version 1.10
I've checked the configuration and ensured that my Amazon S3 credentials are correctly set in the .env file. However, I'm still unable to get the app to upload images to Amazon S3.
Is there something I'm missing in my configuration, or is there a step I need to take to make Sylius use Amazon S3 for image storage? Any guidance on how to troubleshoot or resolve this issue would be greatly appreciated. Thank you!