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-cdk.aws_events: Resolution error: Supplied properties not correct for "CfnEventBusProps" #17172

Closed
ashleydaley opened this issue Oct 26, 2021 · 5 comments
Labels
@aws-cdk/aws-events Related to CloudWatch Events bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/small Small work item – less than a day of effort p1

Comments

@ashleydaley
Copy link

What is the problem?

After pip install aws-cdk 1.129.0, when creating a Stack that contains an aws_events.EventBus that does not have (optional) event_bus_name defined errors with the following message when we cdk synth the app:

jsii.errors.JavaScriptError: 
  Error: Resolution error: Supplied properties not correct for "CfnEventBusProps"
    name: required but missing.
      at ValidationResult.assertSuccess (/tmp/jsii-kernel-RpWQUL/node_modules/@aws-cdk/core/lib/runtime.js:139:19)
      at cfnEventBusPropsToCloudFormation (/tmp/jsii-kernel-RpWQUL/node_modules/@aws-cdk/aws-events/lib/events.generated.js:476:43)
      at CfnEventBus.renderProperties (/tmp/jsii-kernel-RpWQUL/node_modules/@aws-cdk/aws-events/lib/events.generated.js:560:16)
      at PostResolveToken.ret.Resources [as processor] (/tmp/jsii-kernel-RpWQUL/node_modules/@aws-cdk/core/lib/cfn-resource.js:303:52)
      at PostResolveToken.postProcess (/tmp/jsii-kernel-RpWQUL/node_modules/@aws-cdk/core/lib/util.js:81:21)
      at Object.postProcess (/tmp/jsii-kernel-RpWQUL/node_modules/@aws-cdk/core/lib/private/resolve.js:59:82)
      at DefaultTokenResolver.resolveToken (/tmp/jsii-kernel-RpWQUL/node_modules/@aws-cdk/core/lib/resolvable.js:59:38)
      at resolve (/tmp/jsii-kernel-RpWQUL/node_modules/@aws-cdk/core/lib/private/resolve.js:130:55)
      at Object.resolve (/tmp/jsii-kernel-RpWQUL/node_modules/@aws-cdk/core/lib/private/resolve.js:57:48)
      at resolve (/tmp/jsii-kernel-RpWQUL/node_modules/@aws-cdk/core/lib/private/resolve.js:145:51)

After downgrading python module to aws-cdk 1.128.0, the same error does not occur and stack is built successfully

Reproduction Steps

import os
from aws_cdk import core, aws_events

env = core.Environment(region=os.environ["AWS_DEFAULT_REGION"], account=os.environ["AWS_ACCOUNT_ID"])


class TestStack(core.Stack):
    def __init__(
        self,
        scope: core.Construct,
        id: str,
        **kwargs,
    ):
        core.Stack.__init__(self, scope, id, **kwargs)
        aws_events.EventBus(self, "event_bus")


app = core.App()
test_stack = TestStack(app, "test-stack", env=env)
app.synth()

What did you expect to happen?

The stack should synth and build normally, and an auto-generated event_bus_name should be created

What actually happened?

The synth failed with

jsii.errors.JavaScriptError: 
  Error: Resolution error: Supplied properties not correct for "CfnEventBusProps"
    name: required but missing.
      at ValidationResult.assertSuccess (/tmp/jsii-kernel-RpWQUL/node_modules/@aws-cdk/core/lib/runtime.js:139:19)
      at cfnEventBusPropsToCloudFormation (/tmp/jsii-kernel-RpWQUL/node_modules/@aws-cdk/aws-events/lib/events.generated.js:476:43)
      at CfnEventBus.renderProperties (/tmp/jsii-kernel-RpWQUL/node_modules/@aws-cdk/aws-events/lib/events.generated.js:560:16)
      at PostResolveToken.ret.Resources [as processor] (/tmp/jsii-kernel-RpWQUL/node_modules/@aws-cdk/core/lib/cfn-resource.js:303:52)
      at PostResolveToken.postProcess (/tmp/jsii-kernel-RpWQUL/node_modules/@aws-cdk/core/lib/util.js:81:21)
      at Object.postProcess (/tmp/jsii-kernel-RpWQUL/node_modules/@aws-cdk/core/lib/private/resolve.js:59:82)
      at DefaultTokenResolver.resolveToken (/tmp/jsii-kernel-RpWQUL/node_modules/@aws-cdk/core/lib/resolvable.js:59:38)
      at resolve (/tmp/jsii-kernel-RpWQUL/node_modules/@aws-cdk/core/lib/private/resolve.js:130:55)
      at Object.resolve (/tmp/jsii-kernel-RpWQUL/node_modules/@aws-cdk/core/lib/private/resolve.js:57:48)
      at resolve (/tmp/jsii-kernel-RpWQUL/node_modules/@aws-cdk/core/lib/private/resolve.js:145:51)

CDK CLI Version

1.129.0 (build fb43f89)

Framework Version

No response

Node.js Version

14.7.5

OS

Amazon Linux 2

Language

Python

Language Version

3.8.8

Other information

No response

@ashleydaley ashleydaley added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 26, 2021
@github-actions github-actions bot added the @aws-cdk/aws-events Related to CloudWatch Events label Oct 26, 2021
@ashleydaley
Copy link
Author

Setting an event_bus_name allows a successful build, but cdk docs state this to be optional

@rix0rrr
Copy link
Contributor

rix0rrr commented Oct 27, 2021

It's unfortunate that the docs state the parameter is optional, as CloudFormation really states this is required:

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-eventbus.html#cfn-events-eventbus-name

I guess the only thing to do is to invent a name on-the-fly, as we do for other constructs (like cloudwatch.Dashboard).

@rix0rrr rix0rrr added effort/small Small work item – less than a day of effort p1 and removed needs-triage This issue or PR still needs to be triaged. labels Oct 27, 2021
@rix0rrr rix0rrr removed their assignment Oct 27, 2021
@gavllew
Copy link

gavllew commented Nov 1, 2021

I think this had something to do with fix #17008 for issue #14337. Until then, CDK was already inventing a name on-the-fly.

@jasonwadsworth
Copy link

As a work around I ended up setting the name using the name that was generated in previous versions of the CDK.

@github-actions
Copy link

github-actions bot commented Nov 5, 2022

This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Nov 5, 2022
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. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/small Small work item – less than a day of effort p1
Projects
None yet
Development

No branches or pull requests

4 participants