From c55c631c1f2d95864c30af8c4d056209785eb6a7 Mon Sep 17 00:00:00 2001 From: lewenhaupt Date: Mon, 26 Jan 2026 19:24:23 +0100 Subject: [PATCH] fix: remove tableStreamArn hack when tableStreamArn has getter --- src/ServerlessSpy.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/ServerlessSpy.ts b/src/ServerlessSpy.ts index 8d5987d..100cc5b 100644 --- a/src/ServerlessSpy.ts +++ b/src/ServerlessSpy.ts @@ -585,11 +585,19 @@ export class ServerlessSpy extends Construct { (table.node.defaultChild as dynamoDb.CfnTable).streamSpecification = { streamViewType: dynamoDb.StreamViewType.NEW_AND_OLD_IMAGES, }; + var tableStreamArnDescriptor = Object.getOwnPropertyDescriptor( + table, + 'tableStreamArn' + ); - Object.assign(table, { - tableStreamArn: (table.node.defaultChild as dynamoDb.CfnTable) - .attrStreamArn, - }); + if ( + tableStreamArnDescriptor === undefined || + tableStreamArnDescriptor.get === undefined + ) { + (table as any).tableStreamArn = ( + table.node.defaultChild as dynamoDb.CfnTable + ).attrStreamArn; + } this.lambdaSubscriptionMain.function.addEventSource( new dynamoDbStream.DynamoEventSource(table, {