{"record":{"id":"80eb198f634168e2","repo":"anomalyco/sst","slug":"the-provided-arn-arn-is-not-a-lambda-function","errorCode":null,"errorMessage":"The provided ARN \"${arn}\" is not a Lambda function ARN.","messagePattern":"The provided ARN \"(.+?)\" is not a Lambda function ARN\\.","errorType":"validation","errorClass":"VisibleError","httpStatus":null,"severity":"error","filePath":"platform/src/components/aws/helpers/arn.ts","lineNumber":8,"sourceCode":"import { aws } from \"../..\";\nimport { VisibleError } from \"../../error\";\n\nexport function parseFunctionArn(arn: string) {\n  // arn:aws:lambda:region:account-id:function:function-name\n  const functionName = arn.split(\":\")[6];\n  if (!arn.startsWith(\"arn:\") || !functionName)\n    throw new VisibleError(\n      `The provided ARN \"${arn}\" is not a Lambda function ARN.`,\n    );\n  return { functionName };\n}\n\nexport function splitQualifiedFunctionArn(arn: string) {\n  // Unqualified: arn:aws:lambda:region:account-id:function:function-name (7 parts)\n  // Qualified:   arn:aws:lambda:region:account-id:function:function-name:alias-or-version (8 parts)\n  const parts = arn.split(\":\");\n  if (parts.length <= 7) {\n    return { unqualifiedArn: arn, qualifier: undefined };\n  }\n  return {\n    unqualifiedArn: parts.slice(0, 7).join(\":\"),\n    qualifier: parts[7],\n  };\n}\n","sourceCodeStart":1,"sourceCodeEnd":26,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/aws/helpers/arn.ts#L1-L26","documentation":"parseFunctionArn validates that a user-supplied string is a well-formed Lambda function ARN (arn:...:function:name). It throws a VisibleError when the string does not start with 'arn:' or has no function-name segment at index 6.","triggerScenarios":"Calling Function.fromFunctionArn (or a subscriber expecting an ARN) with a function name, a URL, a partial ARN missing the function-name field, or a non-Lambda ARN.","commonSituations":"Passing a function name instead of its ARN, copying an ARN for a lambda version/alias incorrectly, referencing an S3 or IAM ARN by mistake, region/account segments omitted.","solutions":["Use the full 7-segment form: arn:aws:lambda:region:account-id:function:function-name","If you only have the name, construct the ARN with the correct region and account ID","Check the source of the ARN string (e.g. CloudFormation export, env var) for truncation or whitespace"],"exampleFix":"// before\nFunction.fromFunctionArn(stack, \"Fn\", \"my-function\");\n// after\nFunction.fromFunctionArn(stack, \"Fn\", \"arn:aws:lambda:us-east-1:123456789012:function:my-function\");","handlingStrategy":"validation","validationCode":"const LAMBDA_ARN = /^arn:aws[a-zA-Z-]*:lambda:[^:]+:\\d{12}:function:.+$/;\nif (!LAMBDA_ARN.test(arn)) throw new Error(`Not a Lambda ARN: ${arn}`);","typeGuard":"function isLambdaArn(v: string): boolean {\n  return /^arn:aws[a-zA-Z-]*:lambda:[^:]+:\\d{12}:function:.+$/.test(v);\n}","tryCatchPattern":"try {\n  const { functionName } = parseFunctionArn(arn);\n} catch (e) {\n  throw new Error(`Failed to parse Lambda ARN \"${arn}\": ${(e as Error).message}`);\n}","preventionTips":["Copy ARNs verbatim from the AWS console or use Function.arn from SST components","Keep a small regex validator for each ARN type in shared code","Beware alias/version ARNs contain a colon-qualified name; validate accordingly"],"tags":["arn","lambda","validation","sst"],"backgroundTag":"invalid-arn-format","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}