URL format for AWS S3 network requests

2 days ago 2
ARTICLE AD BOX

I maintain a project that stores files in S3, and uses local filesystem as fallback for local development. Good or bad, it's been working reliably for 9 years.

I want to add a S3 emulator to develop tagging. I've tried all the major players and none work. No matter the software, the error is always that the bucket cannot be found, what makes me wonder if there's something subtly wrong in our codebase.

We use AWS SDK for PHP and the error is always the same:

/** @var \Aws\S3\S3Client $s3Client */ $s3Client->upload($bucket, $filePath, $content, $privacy, [ 'params' => [ 'Metadata' => [ 'Content-Disposition' => 'attachment; filename="' . $fileFullName . '"', ], 'ChecksumAlgorithm' => 'SHA256', ], ]);

Error executing "PutObject" on "http://customer-artifacts.localhost:9999/some-path/documents/421e49d410d9fef81740.png"; AWS HTTP error:

NoSuchBucket (client): The specified bucket does not exist

I have the impression that S3 server expects this format:

http://localhost:9999/customer-artifacts/customer-artifacts/some-path

If so, why is our implementation using this other format, and why does it work in production with actual AWS S3?

http://customer-artifacts.localhost:9999/some-path
Read Entire Article