Clayton
11/10/2021, 2:29 PMapi.attachPermissionsToRoute('POST /', [eventHubBus]);
This syntax…
api.attachPermissionsToRoute('POST /', [[eventHubBus, 'grantPutEventsTo']]);
…throws an error –
TypeError: construct[methodName] is not a function
This seems to happen with using either ``attachPermissions` or .attachPermissionsToRoute
.
Am I monkeying up the syntax somehow or is there be another issue that might cause this? ThanksClayton
11/10/2021, 2:32 PMapi.attachPermissionsToRoute('POST /', [
new iam.PolicyStatement({
actions: ["events:PutEvents"],
effect: iam.Effect.ALLOW,
resources: [ eventHubBus.eventBusArn ],
}),
]);
thdxr
11/10/2021, 2:47 PMeventHubBus
an sst construct or cdkClayton
11/10/2021, 2:48 PMconst eventHubBus = new sst.EventBus(this, 'Event Hub Bus', {
eventBridgeEventBus: events.EventBus.fromEventBusArn(this, 'EventHubBus', subsystemEventHubBusArn),
});
thdxr
11/10/2021, 2:48 PMthdxr
11/10/2021, 2:48 PM[eventHubBus.eventBridgeEventBus, "grantPutEventsTo"]
thdxr
11/10/2021, 2:49 PMClayton
11/10/2021, 2:51 PMerror TS2740: Type 'IEventBus' is missing the following properties from type 'Construct': onValidate, onPrepare, onSynthesize, validate, and 2 more.
thdxr
11/10/2021, 2:52 PM[<events.EventBus>eventHubBus.eventBridgeEventBus, "grantPutEventsTo"]
thdxr
11/10/2021, 2:53 PM[eventBus.grantPutEventsTo]
Instead of a tuple with a string for the function name?Clayton
11/10/2021, 2:56 PM<events.EventBus>
thdxr
11/10/2021, 3:00 PMFrank
[eventBus.grantPutEventsTo]Yeah definitely looks cleaner.. I wasn’t able to get it to work 😅 and went with the current way we have.
Frank
grantX
calls take more than 1 argument. Not sure how the syntax will look like.