Hi There, I am trying out Kinesis Client in JS SDK V3. When I create a Kinesis Client in the global scope and reuse the same client for all further Kinesis ingestion, I am noticing that after a while I am getting the following error.
1|new-sig | { Error [ERR_HTTP2_INVALID_SESSION]: The session has been destroyed
1|new-sig | at ClientHttp2Session.request (internal/http2/core.js:1559:13)
1|new-sig | at Promise (/home/ec2-user/signaling-v7.temasys.io/node_modules/@aws-sdk/node-http-handler/dist-cjs/node-http2-handler.js:57:33)
1|new-sig | at new Promise (<anonymous>)
1|new-sig | at NodeHttp2Handler.handle (/home/ec2-user/signaling-v7.temasys.io/node_modules/@aws-sdk/node-http-handler/dist-cjs/node-http2-handler.js:37:16)
1|new-sig | at stack.resolve (/home/ec2-user/signaling-v7.temasys.io/node_modules/@aws-sdk/client-kinesis/dist-cjs/commands/PutRecordCommand.js:27:58)
1|new-sig | at /home/ec2-user/signaling-v7.temasys.io/node_modules/@aws-sdk/middleware-serde/dist-cjs/deserializerMiddleware.js:5:32
1|new-sig | at /home/ec2-user/signaling-v7.temasys.io/node_modules/@aws-sdk/middleware-signing/dist-cjs/middleware.js:11:26
1|new-sig | at process._tickCallback (internal/process/next_tick.js:68:7) '$metadata': { attempts: 1, totalRetryDelay: 0 } }
I am not getting an idea as to why this is happening. However when I use a custom requestHandler and disable Keep-Alive the client stops throwing the error (like the below code)
const { NodeHttpHandler } = require("@aws-sdk/node-http-handler");
const { Agent } = require("http");
const kinesisClient = new KinesisClient({ region: kinesisDataStream.region,
requestHandler: new NodeHttpHandler({
httpAgent: new Agent({keepAlive: false})
})});
Could you help me in understanding what's going on ? Thanks a lot.