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-events): EventBus no longer generates a name if needed #18070

Closed
ChrisSargent opened this issue Dec 17, 2021 · 1 comment · Fixed by #18153
Closed

(aws-events): EventBus no longer generates a name if needed #18070

ChrisSargent opened this issue Dec 17, 2021 · 1 comment · Fixed by #18153
Labels
@aws-cdk/aws-events Related to CloudWatch Events bug This issue is a bug. effort/small Small work item – less than a day of effort p1

Comments

@ChrisSargent
Copy link

What is the problem?

Before v1.29.0, when creating an EventBus without giving a specified name, cdk would generate one automatically (or if using cdk.physicalName.GENERATE_IF_NEEDED

A change made in v1.29.0 here, changed that behaviour: 707fa00#diff-e578aba9e8d0d3ee80700fb06d4ab56133d869f88887efd65941d6e2e90bec98

The 'offending' line seems to be line 280 where the addition return was added.

Reproduction Steps

I have create a minimal reproduction here:

Working version: https://github.com/ChrisSargent/cdk-issues/tree/cdkv1-working

Failing version: https://github.com/ChrisSargent/cdk-issues/tree/cdkv1-failing

Diff showing only package versions changed:ChrisSargent/cdk-issues@cdkv1-working...cdkv1-failing

FYI commenting lines 279 - 281 'fixes' this particular issue but I'm not sure if that is the right long-term fix.

What did you expect to happen?

The physical name to be generated

What actually happened?

Synth Errors:

/cdk-issues/node_modules/@aws-cdk/core/lib/runtime.ts:134
      throw new CfnSynthesisError(message);
            ^
Error: Resolution error: Supplied properties not correct for "CfnEventBusProps"
  name: required but missing.
    at ValidationResult.assertSuccess (/cdk-issues/node_modules/@aws-cdk/core/lib/runtime.ts:134:13)
    at cfnEventBusPropsToCloudFormation (/cdk-issues/node_modules/@aws-cdk/aws-events/lib/events.generated.ts:523:43)
    at CfnEventBus.renderProperties (/cdk-issues/node_modules/@aws-cdk/aws-events/lib/events.generated.ts:608:16)
    at PostResolveToken.ret.Resources [as processor] (/cdk-issues/node_modules/@aws-cdk/core/lib/cfn-resource.ts:226:40)
    at PostResolveToken.postProcess (/cdk-issues/node_modules/@aws-cdk/core/lib/util.ts:92:17)
    at Object.postProcess (/cdk-issues/node_modules/@aws-cdk/core/lib/private/resolve.ts:122:78)
    at DefaultTokenResolver.resolveToken (/cdk-issues/node_modules/@aws-cdk/core/lib/resolvable.ts:84:32)
    at resolve (/cdk-issues/node_modules/@aws-cdk/core/lib/private/resolve.ts:212:51)
    at Object.resolve (/cdk-issues/node_modules/@aws-cdk/core/lib/private/resolve.ts:119:77)
    at resolve (/cdk-issues/node_modules/@aws-cdk/core/lib/private/resolve.ts:230:47)
Subprocess exited with error 1

CDK CLI Version

1.129.0

Framework Version

No response

Node.js Version

14

OS

MacOs

Language

Typescript

Language Version

No response

Other information

Original PR: #17008

@ChrisSargent ChrisSargent added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Dec 17, 2021
@github-actions github-actions bot added the @aws-cdk/aws-events Related to CloudWatch Events label Dec 17, 2021
rix0rrr added a commit that referenced this issue Dec 23, 2021
Since the `EventBus` resource requires a name, CDK will generate
one for you.

However, because of the way the logic was written, it would only
generate one for you if you did NOT pass a props object. In effect,
these two statements would have a different effect:

```ts
new EventBus(this, 'Bus');

new EventBus(this, 'Bus', {});
```

Fix that issue.

Fixes #18070.
@rix0rrr rix0rrr added effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. labels Dec 23, 2021
@rix0rrr rix0rrr removed their assignment Dec 23, 2021
@mergify mergify bot closed this as completed in #18153 Jan 3, 2022
mergify bot pushed a commit that referenced this issue Jan 3, 2022
Since the `EventBus` resource requires a name, CDK will generate
one for you.

However, because of the way the logic was written, it would only
generate one for you if you did NOT pass a props object. In effect,
these two statements would have a different effect:

```ts
new EventBus(this, 'Bus');

new EventBus(this, 'Bus', {});
```

Fix that issue.

Fixes #18070.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

github-actions bot commented Jan 3, 2022

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this issue Feb 21, 2022
)

Since the `EventBus` resource requires a name, CDK will generate
one for you.

However, because of the way the logic was written, it would only
generate one for you if you did NOT pass a props object. In effect,
these two statements would have a different effect:

```ts
new EventBus(this, 'Bus');

new EventBus(this, 'Bus', {});
```

Fix that issue.

Fixes aws#18070.


----

*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-events Related to CloudWatch Events bug This issue is a bug. effort/small Small work item – less than a day of effort p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants