Using S3 Storage Plugin in Payload CMS with Next.js
Note: Working in Payload -
3.0.0-beta.58
at the moment with reference to themulti-tenant-single-domain
configuration.
Getting the S3 Storage Plugin to work was a bit tricky compared to what I had worked with previously -> Payload CMS on Server side with GCS instead of S3.
Difference I faced were:
- There's no
staticURL
configuration, and the package version I am using has no support on thegenerateFileName
function on the plugin option. - S3 configuration works updates on the Bucket Policy, the IAM user credentials and getting the endpoint URL was a bit hard as well (made a few typos here).
- Make sure the IAM user credentails (key and secret) has accesss to the bucket.
- Bucket policy has public reads enabled.
- Bucket endpoint should look something like this -
https://s3.{region}.amazonaws.com
even though the actual endpoint ishttps://{bucket-name}.s3.{region}.amazonaws.com
, thebucket-name
gets added automatically by the plugin.