seems to be a permissions issue with the latest version.
Did you create a custom permission called "NextStaticAssetsS3Bucket" and attach it to yourself?
Can you share or remove?
@garrettmac What error are you getting?
@danielcondemarin - Looks like this may have something to do with using the following S3 url format when defining assetPrefix in next.config.js:
https://mybucketname.s3.amazonaws.com
Note, the https://s3.amazonaws.com/mybucketname has officially been deprecated by AWS.
See https://aws.amazon.com/blogs/aws/amazon-s3-path-deprecation-plan-the-rest-of-the-story/
When using the mybucketname.s3.amazonaws.com style of url in next.config.js, I get the following error:
Serverless Error ---------------------------------------
An error occurred: NextStaticAssetsS3Bucket - mybucketname already exists.
This error occurs when I've already created the bucket for assets, or if the plugin has created the bucket for me.
@danielcondemarin - This issue also occurs with serverless-nextjs-plugin version 1.8.0
Looks like the same thing happens when you set assetsBucketName in serverless.yml and remove the assetPrefix setting from next.config.js.
Sounds like the logic is reversed somewhere.
If the assetsBucketName is set in the serverless.yml, the plugin should not try to create a bucket - correct?
Setting uploadBuildAssets in serverless.yml to false works as intended.
And then I can manually upload my own assets.
Other than this one bug, this plugin is super !
Update: I think this has something to do with having existing .next or .serverless directories present before running serverless deploy.
Even with uploadBuildAssets set to false, I still get the following error when the .next/.serverless directories exist:
Serverless Error ---------------------------------------
An error occurred: NextStaticAssetsS3Bucket - mybucketname already exists.
This issue was driving me up the wall!
Finally figured it out--there's a parameter createAssetBucket which controls whether the stack update attempts to create the bucket. You need to set this to false if the bucket already exists:
custom:
serverless-nextjs:
createAssetBucket: false
I think this behavior should be documented or it should set createAssetBucket based on a describeBucket result since I dropped this plugin once before due to running into this.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
This issue was driving me up the wall!
Finally figured it out--there's a parameter
createAssetBucketwhich controls whether the stack update attempts to create the bucket. You need to set this to false if the bucket already exists:I think this behavior should be documented or it should set
createAssetBucketbased on a describeBucket result since I dropped this plugin once before due to running into this.