Hi team, I’m seeing some unexpected behaviour in N...
# support
m
Hi team, I’m seeing some unexpected behaviour in Node SDK. For some reason, it’s trying to flush events very frequently, and in doing so, a lot of calls to the API fail because the batch array is empty. I’ll attach the relevant screenshots and snippets in the thread
m
Hey There! 👋 Your message has been received by the RudderStack team. We will forward this request to your Technical Account Manager, and they will get back to you shortly. Please use the thread for any additional comments.
m
Screenshot of rudder sending events
Here, some requests pass, but many fail with this error:
Here is the payload for this request:
Some requests with valid payload do go through:
Here is my configuration :
Copy code
new RudderAnalytics('<write-key>', {
            dataPlaneUrl: '<dataplane-url>',
            axiosInstance: httpService.axiosRef,
            errorHandler: (error) => {
              this.logger.error('Error in RudderAnalyticsService');
            },
            gzip: false,
            logLevel: 'debug',
            flushAt: 50,
            flushInterval: 10000 * 60,
            maxQueueSize: 1024 * 350, 
            maxInternalQueueSize: 20000,
          });
The payload for erroring request is this :
Copy code
{
  "batch": [],
  "timestamp": "2023-07-24T15:09:04.977Z",
  "sentAt": "2023-07-24T15:09:04.977Z"
}
m
Hi Aditya. The NodeJS SDK has a retry mechanism that retries sending failed events. Since the payload JSON is incorrect and the event fails to be delivered, it is retried again.
m
Hi @shy-kite-21035, Is there a way where we can stop this from happening? I did not find anything in the docs. Ideally sdk should handle these errors internally, but if there’s any way sdk consumer can set minimum number of events after which a batch call should be made, I’ll be happy to use it
m