Skip to content

Instantly share code, notes, and snippets.

@typehorror
Last active June 27, 2017 19:36
Show Gist options
  • Save typehorror/c788fb5c16597fc07a51a7d0b731083e to your computer and use it in GitHub Desktop.
Save typehorror/c788fb5c16597fc07a51a7d0b731083e to your computer and use it in GitHub Desktop.
Lambda function name error

Hey guys,

I've suddenly (around 11:30am Pacific) been getting this error on every single one of my API gateway -> lambda calls. I'm using Terraform and Apex to manage my deployment. This happened after my latest deployment. No changes to my method names occurred. Also, I've tested the ARN versus the RegExp your error mentions and it actually matches:

Error

{"message": "1 validation error detected: Value \'arn:aws:lambda:us-east-1:347978430301:function:arn:aws:lambda:us-east-1:347978430301:function:experiment_stamps\' at \'functionName\' failed to satisfy constraint: Member must satisfy regular expression pattern: (arn:(aws|aws-us-gov):lambda:)?([a-z]{2}(-gov)?-[a-z]+-\\d{1}:)?(\\d{12}:)?(function:)?([a-zA-Z0-9-_\\.]+)(:(\\$LATEST|[a-zA-Z0-9-_]+))?"}
Tue Jun 27 19:12:08 UTC 2017 : Endpoint response body before transformations: {"message":"1 validation error detected: Value 'arn:aws:lambda:us-east-1:347978430301:function:arn:aws:lambda:us-east-1:347978430301:function:experiment_notifications' at 'functionName' failed to satisfy constraint: Member must satisfy regular expression pattern: (arn:(aws|aws-us-gov):lambda:)?([a-z]{2}(-gov)?-[a-z]+-\\d{1}:)?(\\d{12}:)?(function:)?([a-zA-Z0-9-_\\.]+)(:(\\$LATEST|[a-zA-Z0-9-_]+))?"}

RegExp

>>> regex = /(arn:(aws|aws-us-gov):lambda:)?([a-z]{2}(-gov)?-[a-z]+-\d{1}:)?(\d{12}:)?(function:)?([a-zA-Z0-9-_\.]+)(:(\$LATEST|[a-zA-Z0-9-_]+))?/
/(arn:(aws|aws-us-gov):lambda:)?([a-z]{2}(-gov)?-[a-z]+-\d{1}:)?(\d{12}:)?(function:)?([a-zA-Z0-9-_\.]+)(:(\$LATEST|[a-zA-Z0-9-_]+))?/
>>> regex.test("arn:aws:lambda:us-east-1:347978430301:function:arn:aws:lambda:us-east-1:347978430301:function:experiment_notifications")
true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment