Description
Hi
I'm using @segment/analytics-node
to track analytics from my Lambda functions (runtime Node 18.x).
I recently noticed that by mistake some tests ran using Node 16 so I decided to fix that but when I upgraded to Node 18 (only changed the runtime for the tests), the tests that were meant to make sure analytics are sent started failing.
From my investigation it looks like the request itself was not sent, but event after I manually flushed (await client.flush()
) the events the tests kept failing.
We use the following client configuration:
const analytics = new Analytics({
flushAt: 1,
writeKey: <api_key>
});
We create a new client with each tracked event (tried to use a single client but that didn't help).
It's worth mentioning that I tried to sent flushInterval
to 0 and it didn't help and I also tried waiting for 2.5 seconds after flushing and that did not help either.
Our tests fail on the line that checks that a request was sent to https://api.segment.io/v1/batch
.
Would appreciate any help with that.
Thanks.