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

[aws-elasticloadbalancingv2] ApplicationListener.addTargetGroups() ignores the new conditions array #9262

Closed
realharry opened this issue Jul 25, 2020 · 1 comment · Fixed by #9939
Assignees
Labels
@aws-cdk/aws-elasticloadbalancingv2 Related to Amazon Elastic Load Balancing V2 bug This issue is a bug. effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md in-progress This issue is being actively worked on. p1

Comments

@realharry
Copy link

ApplicationListener.addTargetGroups() accepts an AddApplicationTargetGroupsProps argument. According to the doc (https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-elasticloadbalancingv2.AddApplicationTargetGroupsProps.html), existing fields such as hostHeader have been deprecated and a new field, conditions have been added. However, the conditions field is not accepted by the addTargetGroups() method, and it throws an error:

At least one of 'conditions', 'hostHeader', 'pathPattern' or 'pathPatterns' is required when defining a load balancing rule.

Reproduction Steps

    const hostHeaders = [props.domain1, props.domain2];
    listener.addTargetGroups(
      listenerTgId,
      {
        targetGroups: [extraTG],
        conditions: [
          elb.ListenerCondition.hostHeaders(hostHeaders),
        ],
        priority: props.priority,
      }
    );

Error Log

At least one of 'conditions', 'hostHeader', 'pathPattern' or 'pathPatterns' is required when defining a load balancing rule.

/projects/app1/node_modules/@aws-cdk/core/lib/private/synthesis.ts:118
    throw new Error(`Validation failed with the following errors:\n  ${errorList}`);
          ^
Error: Validation failed with the following errors:
  [Inf2AlphaMetroshopandplacTg/listener/extraTg] Listener rule needs at least one action
    at validateTree (/extra0/Projects/shoppingweb/devops/infra2-angular-apps/node_modules/@aws-cdk/core/lib/private/synthesis.ts:118:11)
    at Object.synthesize (/extra0/Projects/shoppingweb/devops/infra2-angular-apps/node_modules/@aws-cdk/core/lib/private/synthesis.ts:21:5)
    at App.synth (/extra0/Projects/shoppingweb/devops/infra2-angular-apps/node_modules/@aws-cdk/core/lib/stage.ts:168:23)
    at process.<anonymous> (/extra0/Projects/shoppingweb/devops/infra2-angular-apps/node_modules/@aws-cdk/core/lib/app.ts:112:45)
    at Object.onceWrapper (events.js:422:26)
    at process.emit (events.js:315:20)
    at process.EventEmitter.emit (domain.js:483:12)
    at process.emit (/extra0/Projects/shoppingweb/devops/infra2-angular-apps/node_modules/source-map-support/source-map-support.js:495:21)
Subprocess exited with error 1

Environment

  • **CLI Version :1.50.0 (build 84acc92)
  • **Framework Version:1.54.0
  • **Node.js Version:v12.18.3
  • **OS :ubuntu 20.04
  • **Language (Version):typescript 3.9.7

Other


This is 🐛 Bug Report

@realharry realharry added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 25, 2020
@github-actions github-actions bot added the @aws-cdk/aws-elasticloadbalancingv2 Related to Amazon Elastic Load Balancing V2 label Jul 25, 2020
@realharry
Copy link
Author

Found a related issue, #8328, which was marked as fixed as of 6/05/2020.

@ericzbeard ericzbeard removed the needs-triage This issue or PR still needs to be triaged. label Jul 27, 2020
@ericzbeard ericzbeard removed their assignment Jul 28, 2020
@rix0rrr rix0rrr added effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md p1 labels Aug 4, 2020
@SomayaB SomayaB assigned njlynch and unassigned rix0rrr Aug 20, 2020
njlynch added a commit that referenced this issue Aug 24, 2020
…ribute

New conditions attribute usage was fixed in #8385 for owned listeners, but
missed imported listeners.

fixes #9262
fixes #9320
fixes #9643
@njlynch njlynch added the in-progress This issue is being actively worked on. label Aug 24, 2020
@mergify mergify bot closed this as completed in #9939 Aug 24, 2020
mergify bot pushed a commit that referenced this issue Aug 24, 2020
…ribute (#9939)

New conditions attribute usage was fixed in #8385 for owned listeners, but
missed imported listeners.

fixes #9262
fixes #9320
fixes #9643


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-elasticloadbalancingv2 Related to Amazon Elastic Load Balancing V2 bug This issue is a bug. effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md in-progress This issue is being actively worked on. p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants