serverless-next.js: Deployment fails with --aws-s3-accelerate

Describe the bug Deployment of the serverless-next.js component fails when using --aws-s3-accelerate.

To Reproduce We can see this behaviour on a failing github action: https://github.com/Meemaw/next-aws-lambda/runs/258201271

Expected behavior Deployment should work

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 25 (7 by maintainers)

Most upvoted comments

For me, the solution was just to use --no-aws-s3-accelerate param when calling serverless

Hi folks. Sorry I’ve not been able to look into this before.

After reading the AWS Documentation for S3 bucket acceleration I think it would be worth trying to check whether the bucket has acceleration enabled before uploading. I suspect putBucketAccelerateConfiguration may be eventually consistent, therefore causing a race condition when we try uploading straight after creating the bucket. I am in the process of creating a new package for handling static assets uploads to S3 that removes the dependency to the aws-s3 component. Once that’s ready I’ll make sure this issue is fixed.

I’m getting this issue on overhalf my deploys - it appears to be a race condition as you can repeatedly run the deployment until it works.

Current workaround is to use a precreated bucket already configured with acceleration and use the bucketName option.

The issue is much more apparent when I switched to using serverless from within a Github Action workflow.

Just implemented a CI/CD pipeline (was experimenting with this component from my machine until now). Removed all my previous infrastructure and wanted to deploy it all during CI/CD with syncing a brand new .serverless folder that was kicked off from CI/CD.

Failed on first build using serverless-next.js@1.12.0-alpha.6 with S3 Transfer Acceleration is not configured on this bucket.

All builds after the first work fine so far.

@james-calmus-dt Could you share your serverless.yml?

Serverless.yml

site:
  component: serverless-next.js@1.11.1

At the moment it seems to be deploying correctly but I’ll monitor it and let you know if we experience any other problems.

@danielcondemarin Good suggestion, unfortunately still the same error – and tried this time with a randomly generated bucket name instead.