aws-sdk-js-v3: Protocol error in kinesis putRecords in aws sdk > 3.81.0
Describe the bug
node:internal/http2/util in new NghttpError at line 556:5
Your environment
SDK version number
"@aws-sdk/client-dynamodb": "3.87.0",
"@aws-sdk/client-kinesis": "3.88.0",
"@aws-sdk/client-s3": "^3.88.0",
"@aws-sdk/client-sqs": "^3.87.0",
Is the issue in the browser/Node.js/ReactNative?
Node.js
Details of the browser/Node.js/ReactNative version
Node.js v16.15.0
Steps to reproduce
Reproduces only in production 😦 Code:
const usRequests: StatRequest[] = [];
const euRequests: StatRequest[] = [];
async function sendToKinesis(requests: StatRequest[], kinesis: KinesisClient, streamName: string) {
if (requests.length >= flushAfter) {
const requestsToSend = requests.splice(0);
try {
await kinesis.send(
new PutRecordsCommand({
StreamName: streamName,
Records: requestsToSend.map((data, idx) => ({
Data: textEncoder.encode(JSON.stringify(data)),
PartitionKey: idx.toString(),
})),
}),
);
} catch (err) {
logger.error(err as Error);
Sentry.captureException(err);
}
}
}
await sendToKinesis(usRequests, usKinesis, "some-us-stream");
await sendToKinesis(euRequests, euKinesis, "some-eu-stream");
Observed behavior
Getting this error in 90% cases:
Error: Protocol error
File "node:internal/http2/util", line 556, col 5, in new NghttpError
File "node:internal/http2/core", line 785, col 26, in Http2Session.onSessionInternalError
File "node:internal/async_hooks", line 130, col 17, in Http2Session.callbackTrampoline
Expected behavior
No error
Additional context
3.81 worked fine
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (4 by maintainers)
16.15.0-alpine3.15
image.More or less how we write to Kinesis to give you guys an idea:
@AllanZhengYP @up73k @L1fescape my issue appears to be stable and resolved. LGTM.
@gugu how about yours?
Hi @gugu, thanks for reporting this. I expect that one of our developers take a look to this as soon as possible. In the meantime you could use the version 3.81 as @curtdept recommended.
Thanks!