Defer background functions comes without a concurrency limit by default. While Defer guarantees to pick up execution by their creation order, it cannot guarantee strict sequential processing when concurrency is enabled.

Processing executions in sequence is a requirement for multiple scenarios:

  • Processing certain webhooks (e.g., Shopify webhooks)
  • Processing tracking events (e.g., Hubspot events)
  • Dealing with strict 3rd party rate limiting.

How to enable the FIFO mode

To enable FIFO processing, set concurrency to 1 as follows:

import { defer } from "";

const importContacts = () => {
  // ...
export default defer(importContacts, {
  concurrency: 1,