Skip to main content

I recently just pushed a new feature up to our app that runs two brief events back to back that, once completed, have an Amplitude event that fires off stating that the event was successful. Because these events are pretty quick, Amplitude will usually log the second event anywhere from 100-200 MS after the first event.

However, I’ve noticed that ten percent of the time, the second Amplitude event didn’t fire (even though I can see other data supporting that the event ran successfully, including with temporary Sentry logging we added to confirm that the event ran and Amplitude wasn’t capturing the event while Sentry was).

We ended up adding a timeout of 1 second before firing the second Amplitude event. That has significantly decreased the number of times the second Amplitude event did not fire to less than 1 percent of the time.

But that does have us wondering if Amplitude is somehow not capturing the second of two events with different names from the same file that happen pretty quickly after each other. Is this a known Amplitude issue?

Hi Ajay,

Thank you for reaching out and providing detailed context about the issue you're experiencing with consecutive Amplitude events. I understand how important it is to ensure all events are captured accurately, and I’m happy to assist.

From your description, it seems that the second event occasionally fails to fire when two events are triggered in quick succession, even though your Sentry logs confirm the event execution. Adding a 1-second timeout has reduced the failure rate, but you’re curious if this behavior is a known issue.

Here are a few points to consider and steps to troubleshoot further:


1. **Event Deduplication**: Amplitude de-duplicates events based on the `insert_id`, `event_id`, and `device_id` within a 7-day window. If the second event shares the same `insert_id` or other identifiers as the first, it might be dropped as a duplicate. You can learn more about this in our HTTP V2 API documentation.
2. **Throttling**: Amplitude enforces a limit of 30 events per second per device. If this threshold is exceeded, some events may be throttled and not ingested. While this seems unlikely given your scenario, it’s worth verifying. More details are available in our limits documentation: https://amplitude.com/docs/faq/limits.
3. **SDK Configuration**: If you’re using one of our SDKs, ensure it’s updated to the latest version, as older versions may have known issues. Additionally, check the event batching configuration (e.g., `flushIntervalMillis` and `flushQueueSize`) to ensure events are sent promptly. You can find more information in our SDK troubleshooting guide: https://amplitude.com/docs/sdks/sdk-debugging.
4. **Enable Logging**: I would recommend turning on logging in the SDK to capture any errors or warnings that may be occurring. For example, in the Browser SDK, you can set the `logLevel` to the highest setting, `Debug`. This can help identify the root cause of the issue. You can find more details on enabling logging in the Browser SDK documentation: https://amplitude.com/docs/sdks/analytics/browser/browser-sdk-2.
5. **Batching**: Our SDKs offer batching out of the box, perhaps you can enable this feature `useBatch` to leverage our Batch API endpoint which offers more flexible limits. You could also increase `flushQueueSize` and `flushIntervalMillis` in the SDK to send events in batches.


### Next Steps:

- **Verify Insert IDs**: Ensure each event has a unique `insert_id` to avoid deduplication.
- **Check SDK Version**: Confirm you’re using the latest version of the SDK and review your batching settings.
- **Enable SDK Logging**: Turn on logging to capture any errors or warnings for further troubleshooting.
- **Review Logs**: If possible, share the payloads of the affected events, including `insert_id`, `event_name`, and timestamps. This will help us investigate further.

If the issue persists after these steps, please let me know, and I’ll be happy to assist further. Sharing additional details, such as the SDK version you’re using and any relevant code snippets, would also be helpful.

Looking forward to your response!

Best,
Eddie


P.S. Checkout upcoming events and user meetups on our events page.

Reply