简体   繁体   中英

error creating Lambda Event Source Mapping (): InvalidParameterValueException: Unrecognized event source

I am trying to create a trigger such that every time a new entry in my dynamo table filenames is created, the lambda function trigger_lambda_function is triggered. I followed this: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_event_source_mapping

resource "aws_dynamodb_table" "filenames" {
  name           = local.dynamodb_table_filenames
  billing_mode   = "PROVISIONED"
  read_capacity  = 1000
  write_capacity = 1000
  hash_key       = "filename"

  #range_key      = ""

  attribute {
    name = "filename"
    type = "S"
  }

  tags = var.tags
}


resource "aws_lambda_event_source_mapping" "allow_dynamodb_table_to_trigger_lambda" {
  event_source_arn  = aws_dynamodb_table.filenames.stream_arn
  function_name     = aws_lambda_function.trigger_stepfunction_lambda.arn
  starting_position = "LATEST"
}

Currently, I am getting an error that:

│ Error: error creating Lambda Event Source Mapping (): InvalidParameterValueException: Unrecognized event source.
│ {
│   RespMetadata: {
│     StatusCode: 400,
│     RequestID: "5ae68da6-3f6d-4adb-b104-72ae584dbca7"
│   },
│   Message_: "Unrecognized event source.",
│   Type: "User"
│ }
│ 
│   with module.ingest_system["alpegatm"].aws_lambda_event_source_mapping.allow_dynamodb_table_to_trigger_lambda,
│   on ../../modules/ingest_system/dynamo.tf line 39, in resource "aws_lambda_event_source_mapping" "allow_dynamodb_table_to_trigger_lambda":
│   39: resource "aws_lambda_event_source_mapping" "allow_dynamodb_table_to_trigger_lambda" {

How can I fix this? What is wrong with the event_source_arn I am using?

I believe you need to turn on streaming for the dynamo table.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM