Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Split within a Lambda that streams responses #794

Open
roy2006 opened this issue Mar 19, 2024 · 2 comments
Open

Using Split within a Lambda that streams responses #794

roy2006 opened this issue Mar 19, 2024 · 2 comments

Comments

@roy2006
Copy link

roy2006 commented Mar 19, 2024

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.

@roy2006
Copy link
Author

roy2006 commented Mar 19, 2024

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.

@agustinona
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants