-
Notifications
You must be signed in to change notification settings - Fork 4.5k
(integ-tests-alpha): awsApiCall failing for Kinesis putRecord - cannot properly pass Data #26798
Copy link
Copy link
Closed
Labels
@aws-cdk/aws-kinesisRelated to Amazon KinesisRelated to Amazon KinesisbugThis issue is a bug.This issue is a bug.effort/mediumMedium work item – several days of effortMedium work item – several days of effortnode18-upgradeAny work (bug, feature) related to Node 18 upgradeAny work (bug, feature) related to Node 18 upgradep1sdk-v3-upgradeTag issues that are associated to SDK V3 upgrade. Not limited to CR usage of SDK only.Tag issues that are associated to SDK V3 upgrade. Not limited to CR usage of SDK only.
Description
Describe the bug
When I pass an expected Uint8Array to the params of Kinesis.putRecord I receive the failure message
Received response status [FAILED] from custom resource. Message returned: Cannot read properties of undefined (reading 'byteLength')
Expected Behavior
Put record should succeed with the input expected by the PutRecordCommandInput interface
Current Behavior
Here is the relevant log from the assertion lambda:
2023-08-18T00:01:41.346Z 5ad0ff87-aaa8-4784-9458-8f1de4e21e51 INFO SDK request to Kinesis.putRecord with parameters
{
"StreamName": "KinesisEventProcessingIntegrationStack",
"PartitionKey": "testKey",
"Data": {
"0": 123,
"1": 34,
"2": 110,
"3": 97,
"4": 109,
"5": 101,
"6": 34,
"7": 58,
"8": 34,
"9": 119,
"10": 111,
"11": 114,
"12": 108,
"13": 100,
"14": 34,
"15": 125
}
}
I think this is because the parameters are encoded with JSON.stringify which turns a Uint8Array into a JSON
> data
Uint8Array(16) [
123, 34, 110, 97, 109,
101, 34, 58, 34, 119,
111, 114, 108, 100, 34,
125
]
> JSON.stringify(data)
'{"0":123,"1":34,"2":110,"3":97,"4":109,"5":101,"6":34,"7":58,"8":34,"9":119,"10":111,"11":114,"12":108,"13":100,"14":34,"15":125}'
Reproduction Steps
Create a test stack with a kinesis stream and put a record on it with assertions.awsApiCall
const kinesisStream: IStream = new Stream(stack, "TestKinesisStream");
const buf = Buffer.from(JSON.stringify({ name: "world" }));
const data = new Uint8Array(
buf.buffer,
buf.byteOffset,
buf.byteLength / Uint8Array.BYTES_PER_ELEMENT
);
testCase.assertions.awsApiCall("Kinesis", "putRecord", {
StreamName: kinesisStream.streamName,
Data: data,
PartitionKey: "testKey",
});
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.93.0
Framework Version
No response
Node.js Version
18.12.0
OS
MacOS 13.5 (22G74)
Language
Typescript
Language Version
No response
Other information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-kinesisRelated to Amazon KinesisRelated to Amazon KinesisbugThis issue is a bug.This issue is a bug.effort/mediumMedium work item – several days of effortMedium work item – several days of effortnode18-upgradeAny work (bug, feature) related to Node 18 upgradeAny work (bug, feature) related to Node 18 upgradep1sdk-v3-upgradeTag issues that are associated to SDK V3 upgrade. Not limited to CR usage of SDK only.Tag issues that are associated to SDK V3 upgrade. Not limited to CR usage of SDK only.