Last updated

Common issues and best practices

This page explains commonly encountered issues during webhook deliveries and best practices to minimize these problems.

Head-of-line blocking

Spotnana’s architecture is designed to isolate each partner’s subscriptions, so that the performance of one partner endpoint will not affect the other. However, as a best practice to avoid any out-of-order messages and interleaved transactions due to head-of-line blocking, we recommend you maintain responsive APIs with low latency.

Retry mechanism

If your API responds with a status code other than 200 OK, our systems will mark the webhook delivery as failed. This will initiate a retry attempt up to five times, with no specified time interval between each retry.

Out-of-order messages

Some best practices to resolve any out-of-order message deliveries are:

  • Use the timestamp field: This field indicates the time the message was generated by Spotnana. You can use the timestamp to determine the correct order in which the events occurred.
  • Design for idempotent operations: Sometimes due to network issues or other rare scenarios, a message might be delivered multiple times. Ensure that your webhook processing logic is idempotent and capable of handling the same message multiple times. You can leverage the operation and the timestamp fields to design your code to be idempotent.
  • Process the entire payload: Instead of performing a diff on the payload, it is recommended to process the entire payload for data consistency.

Logging and tracing

To assist with debugging, Spotnana includes trace and span IDs in all webhook requests as X-B3-TraceId and X-B3-SpanId headers, respectively. Be sure to log these IDs and provide them to Spotnana support when reporting any issues.