Skip to content
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

5 minutes wait to get an error message for aws_lambda_event_source_mapping #14042

Closed
Veetaha opened this issue Jul 3, 2020 · 6 comments · Fixed by #19425
Closed

5 minutes wait to get an error message for aws_lambda_event_source_mapping #14042

Veetaha opened this issue Jul 3, 2020 · 6 comments · Fixed by #19425
Labels
bug Addresses a defect in current functionality. service/lambda Issues and PRs that pertain to the lambda service.
Milestone

Comments

@Veetaha
Copy link
Contributor

Veetaha commented Jul 3, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v0.12.26
+ provider.aws v2.66.0

Your version of Terraform is out of date! The latest version
is 0.12.28. You can update by downloading from https://www.terraform.io/downloads.html

Affected Resource(s)

  • aws_lambda_event_source_mapping
  • aws_lambda_function
  • aws_sqs_queue

Terraform Configuration Files

# No  "sqs:ReceiveMessage", "sqs:DeleteMessage", "sqs:GetQueueAttributes" permissions configured for the lambda
resource "aws_lambda_event_source_mapping" "this" {
  event_source_arn = aws_sqs_queue.this.arn
  function_name = aws_lambda_function.this.arn
  batch_size = 10
}

Expected Behavior

Terraform should report an error right away.

Actual Behavior

I needed to wait for 5 minutes until the error message was shown...

Output
aws_lambda_event_source_mapping.this: Creating...
aws_lambda_event_source_mapping.this: Still creating... [10s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [20s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [30s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [40s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [50s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [1m0s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [1m10s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [1m20s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [1m30s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [1m40s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [1m50s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [2m0s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [2m10s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [2m20s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [2m30s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [2m40s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [2m50s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [3m0s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [3m10s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [3m20s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [3m30s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [3m40s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [3m50s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [4m0s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [4m10s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [4m20s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [4m30s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [4m40s elapsed]
aws_lambda_event_source_mapping.this: Still creating... [4m50s elapsed]

Error: Error creating Lambda event source mapping: InvalidParameterValueException: The provided execution role does not have permissions to call ReceiveMessage on SQS
{
  RespMetadata: {
    StatusCode: 400,
    RequestID: "71bf6150-ee25-4ad5-ac0f-9c51db59dffe"
  },
  Message_: "The provided execution role does not have permissions to call ReceiveMessage on SQS",
  Type: "User"
}

Steps to Reproduce

  1. terraform apply
@ghost ghost added service/lambda Issues and PRs that pertain to the lambda service. service/sqs Issues and PRs that pertain to the sqs service. labels Jul 3, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Jul 3, 2020
@breathingdust breathingdust added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Jul 3, 2020
@bflad
Copy link
Contributor

bflad commented Jul 6, 2020

@breathingdust the best we can do here is potentially lower the retry timeout to our "standard" 2 minutes for the IAM errors -- is that the expectation?

@mattfysh
Copy link

mattfysh commented Aug 1, 2020

Just ran into this same issue but the error here was something that could have been validated upfront:

aws_lambda_event_source_mapping.stream_to_neo4j: Still creating... [4m40s elapsed]
aws_lambda_event_source_mapping.stream_to_neo4j: Still creating... [4m50s elapsed]

Error: Error creating Lambda event source mapping: InvalidParameterValueException: 1 validation error detected: Value null at 'startingPosition' failed to satisfy constraint: Member must not be null.
{
  RespMetadata: {
    StatusCode: 400,
    RequestID: "0a6b1105-x"
  },
  Message_: "1 validation error detected: Value null at 'startingPosition' failed to satisfy constraint: Member must not be null.",
  Type: "User"
}

  on index.tf line 147, in resource "aws_lambda_event_source_mapping" "stream_to_neo4j":
 147: resource "aws_lambda_event_source_mapping" "stream_to_neo4j" {

@tcurdt
Copy link

tcurdt commented Sep 25, 2020

Also ran into this. Getting the error only after the timeout does not make much sense.

aws_lambda_event_source_mapping.deliver: Still creating... [4m50s elapsed]

Error: Error creating Lambda event source mapping: InvalidParameterValueException: Queue visibility timeout: 30 seconds is less than Function timeout: 60 seconds
{
  RespMetadata: {
    StatusCode: 400,
    RequestID: "xxx-478d-4b71-8b2e-678e8de7ae1d"
  },
  Message_: "Queue visibility timeout: 30 seconds is less than Function timeout: 60 seconds",
  Type: "User"
}

@ericluria
Copy link

For anyone else who runs into this issue, you need to add the following statement to a policy attached to the role assumed by your Lambda function:

      {
        Action = [
          "sqs:ReceiveMessage",
          "sqs:DeleteMessage",
          "sqs:GetQueueAttributes",
        ],
        Effect   = "Allow",
        Resource = "arn:aws:sqs:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:<QUEUE_NAME>"
      },

@ewbankkit ewbankkit removed the service/sqs Issues and PRs that pertain to the sqs service. label May 27, 2021
ewbankkit added a commit to delbaeth/terraform-provider-aws that referenced this issue Jun 1, 2021
@github-actions github-actions bot added this to the v3.43.0 milestone Jun 1, 2021
@ghost
Copy link

ghost commented Jun 1, 2021

This has been released in version 3.43.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@github-actions
Copy link

github-actions bot commented Jul 2, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/lambda Issues and PRs that pertain to the lambda service.
Projects
None yet
7 participants