Skip to content

Queue visibility time has to be >= lambda timeout #467

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 18, 2021

Conversation

jonico
Copy link
Contributor

@jonico jonico commented Jan 17, 2021

  • AWS SQS queue visibility times have to be >= the timeout of the associated lambda: source

  • error to do so will result in a terraform provisioning error during initial resource creation of module.runners.module.runners.aws_lambda_event_source_mapping.scale_up:

terraform apply
...
module.runners.module.runners.aws_lambda_event_source_mapping.scale_up: Still creating... [4m20s elapsed]
module.runners.module.runners.aws_lambda_event_source_mapping.scale_up: Still creating... [4m30s elapsed]
module.runners.module.runners.aws_lambda_event_source_mapping.scale_up: Still creating... [4m40s elapsed]
module.runners.module.runners.aws_lambda_event_source_mapping.scale_up: Still creating... [4m50s elapsed]

Error: Error creating Lambda event source mapping: InvalidParameterValueException: Queue visibility timeout: 60 seconds is less than Function timeout: 180 seconds
{
  RespMetadata: {
    StatusCode: 400,
    RequestID: "e6da5176-e0d8-4a81-a34b-378624b78b74"
  },
  Message_: "Queue visibility timeout: 60 seconds is less than Function timeout: 180 seconds",
  Type: "User"
}

Apparently, the constraint is not causing terraform to fail when trying to modify module.runners.module.runners.aws_lambda_event_source_mapping.scale_up with a smaller value afterwards:

terraform apply
...
# module.runners.aws_sqs_queue.queued_builds will be updated in-place
  ~ resource "aws_sqs_queue" "queued_builds" {
        id                                = "https://sqs.eu-west-1.amazonaws.com/869946923544/default-queued-builds.fifo"
        name                              = "default-queued-builds.fifo"
        tags                              = {
            "Project" = "octodemo-baseline-terraform-aws-github-runner"
        }
      ~ visibility_timeout_seconds        = 180 -> 60
        # (8 unchanged attributes hidden)
    }
...
module.runners.module.runners.aws_lambda_function.scale_up: Modifications complete after 6s [id=default-scale-up]

... which may explain how this problem went unnoticed so far

  • setting module.runners.aws_sqs_queue.queued_builds.visibility_timeout_seconds to module.runners.module.runners.aws_lambda_function.scale_up.timeout solves the issue at initial resource creation time

* AWS SQS queue visibility times have to be >= the timeout of the associated lambda
* error to do so will result in a terraform provisioning error during initial resource creation (apparently not a modification)
* hence, setting module.runners.aws_sqs_queue.queued_builds.visibility_timeout_seconds  to module.runners.module.runners.aws_lambda_function.scale_up.timeout
Copy link
Member

@npalm npalm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@npalm
Copy link
Member

npalm commented Jan 18, 2021

@jonico seem we where fixing the issue almost in parallel :)

@npalm npalm merged commit 52c22b5 into github-aws-runners:develop Jan 18, 2021
@jonico jonico deleted the patch-1 branch January 18, 2021 13:57
npalm pushed a commit that referenced this pull request Jan 21, 2021
* AWS SQS queue visibility times have to be >= the timeout of the associated lambda
* error to do so will result in a terraform provisioning error during initial resource creation (apparently not a modification)
* hence, setting module.runners.aws_sqs_queue.queued_builds.visibility_timeout_seconds  to module.runners.module.runners.aws_lambda_function.scale_up.timeout
npalm added a commit that referenced this pull request Jan 21, 2021
* Refactor to loggroup per tuype of logging

* Update modules/runners/variables.tf

Co-authored-by: Gertjan Maas <[email protected]>

* fix: Queue visibility time has to be >= lambda timeout (#467)

* AWS SQS queue visibility times have to be >= the timeout of the associated lambda
* error to do so will result in a terraform provisioning error during initial resource creation (apparently not a modification)
* hence, setting module.runners.aws_sqs_queue.queued_builds.visibility_timeout_seconds  to module.runners.module.runners.aws_lambda_function.scale_up.timeout

* Typo

Co-authored-by: Gertjan Maas <[email protected]>
Co-authored-by: Johannes Nicolai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants