milliHQ / terraform-aws-next-js

Terraform module for building and deploying Next.js apps to AWS. Supports SSR (Lambda), Static (S3) and API (Lambda) pages.
https://registry.terraform.io/modules/milliHQ/next-js/aws
Apache License 2.0
1.47k stars 151 forks source link

error putting S3 Bucket Notification Configuration #348

Closed lesnitsky closed 2 years ago

lesnitsky commented 2 years ago

Sometimes I get this error after terraform apply:

╷
│ Error: error putting S3 Bucket Notification Configuration: InvalidArgument: Unable to validate the following destination configurations
│       status code: 400, request id: 6D9ANCDGTDAC2TN8, host id: f8gNGHqldgiFnyDpq4cLSYIKnyTmFz5Znmg3KI/tsM4aPMZCt9R9UCl6dziCOMHXrDSvt0ruIQ4=
│ 
│   with module.tf_next.module.statics_deploy.aws_s3_bucket_notification.on_create,
│   on .terraform/modules/tf_next/modules/statics-deploy/main.tf line 22, in resource "aws_s3_bucket_notification" "on_create":
│   22: resource "aws_s3_bucket_notification" "on_create" {
│ 

I wasn't able to figure out the conditions under which this error occurs.

ofhouse commented 2 years ago

Thanks for reporting, closing this as a known bug: https://github.com/milliHQ/terraform-aws-next-js/issues/138#issuecomment-864454823

Has something to do that we connect SQS and S3 triggers to the same Lambda which causes some race condition on AWS side. This will be resolved once we ditch SQS for the invalidation queue.