javascript-client
javascript-client copied to clipboard
Using Split within a Lambda that streams responses
I'm using the Split nodejs SDK in my application. It's generally working fine, but I'm running into issues when using the SDK as part of a lambda that streams its response (as shown here). Specifically, the Lambda doesn't complete and just hangs until it times out.
The only thing I'm doing with Split is initializing it using the following code:
const SplitFactory = require('@splitsoftware/splitio').SplitFactory;
const SplitObj = await SplitFactory({
core: {
authorizationKey:splitAuthKey
},
startup: {
readyTimeout :10
},
scheduler: {
impressionsRefreshRate: 1,
eventsPushRate: 2,
}
});
When this code is removed or if it's not executed, the lambda works as expected and finishes immediately after it's done streaming its output.
I'm using SDK version 10.25.1.
I just found out that calling client.destroy before exiting the handler allows the lambda to complete its operation as expected. However, this doesn't seem to be a viable option because it'll require me to initialize split with every lambda invocation.
Hi @roy2006 I believe you've worked this out in our Slack community and found a solution by setting
_context.callbackWaitsForEmptyEventLoop = false
Could you confirm this issue is resolved?