{"record":{"id":"a5db85f0cf3369fb","repo":"serverless/serverless","slug":"aws-waf-invalid-alb-arn","errorCode":"AWS_WAF_INVALID_ALB_ARN","errorMessage":"Invalid ALB ARN format","messagePattern":"Invalid ALB ARN format","errorType":"exception","errorClass":"ServerlessError","httpStatus":null,"severity":"error","filePath":"packages/engine/src/lib/aws/alb.js","lineNumber":405,"sourceCode":"   * @param {Object} params - The parameters for associating a WAF ACL with an ALB.\n   * @param {string} params.albArn - The ARN of the ALB.\n   * @param {string} params.wafAclArn - The ARN of the WAF ACL.\n   * @returns {Promise<void>}\n   * @throws {ServerlessError} If the ALB ARN or WAF ACL ARN is invalid.\n   */\n  async associateWafToAlb({ albArn, wafAclArn }) {\n    // Validate WAF ACL ARN format\n    if (!wafAclArn.startsWith('arn:aws:wafv2:')) {\n      throw new ServerlessError(\n        'Invalid WAF ACL ARN format',\n        'AWS_WAF_INVALID_ACL_ARN',\n        { stack: false },\n      )\n    }\n\n    // Validate ALB ARN format\n    if (!albArn.startsWith('arn:aws:elasticloadbalancing:')) {\n      throw new ServerlessError(\n        'Invalid ALB ARN format',\n        'AWS_WAF_INVALID_ALB_ARN',\n        { stack: false },\n      )\n    }\n\n    await this.wafClient.send(\n      new AssociateWebACLCommand({\n        ResourceArn: albArn,\n        WebACLArn: wafAclArn,\n      }),\n    )\n  }\n\n  /**\n   * Retrieves and updates a target group.\n   * @param {string} targetGroupName - The name of the target group.\n   * @param {{ path?: string, routingPath?: string }} healthcheck - The healthcheck configuration.","sourceCodeStart":387,"sourceCodeEnd":423,"githubUrl":"https://github.com/serverless/serverless/blob/b9d7ea51c8cce57cff1207964b9b71123673081f/packages/engine/src/lib/aws/alb.js#L387-L423","documentation":"Returned by findClosestMatch (version.go:312) when semver.NewConstraint(constraint) fails to parse the user-supplied frameworkVersion as a valid semver range expression. The Masterminds/semver library rejects strings that do not conform to its constraint grammar.","triggerScenarios":"getVersion calls findClosestMatch with a non-empty frameworkVersion string; semver.NewConstraint returns a parse error because the string is not a valid constraint (e.g. contains illegal characters, unbalanced operators, or bare non-semver text).","commonSituations":"frameworkVersion: latest (not a semver constraint); frameworkVersion: 4..15.0 (double dot); frameworkVersion: >>>=4 (garbled operator); frameworkVersion: v4.15.0 (the 'v' prefix may or may not be accepted depending on library version); accidentally quoting or escaping the value incorrectly in YAML.","solutions":["Use standard semver constraint syntax: ^4.15.0, ~4.15.0, >=4.15.0, or an exact 4.15.0","Remove non-semver values like 'latest' — omit frameworkVersion entirely for latest","Validate the constraint with an online semver checker before committing"],"exampleFix":"# before\nframeworkVersion: latest\n# after\nframeworkVersion: ^4.15.0","handlingStrategy":"validation","validationCode":"// Validate constraint syntax before calling getVersion\nfunc validConstraint(c string) bool {\n    _, err := semver.NewConstraint(c)\n    return err == nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use semver-standard operators: ^, ~, >=, >, <=, <, or exact version","Avoid non-semver keywords like 'latest' — omit frameworkVersion instead","Test constraint strings in a semver calculator before committing"],"tags":["semver","constraint","validation","installer","go"],"backgroundTag":null,"analyzedSha":"b9d7ea51c8cce57cff1207964b9b71123673081f","analyzedAt":"2026-08-13T04:14:40.386Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}