Timeouts and missing idempotency keys duplicate deals
When webhook retries hit HTTP 504 timeouts without idempotency keys, duplicate deals flood your CRM. Here is how submission IDs prevent record cloning.
A sales director logs into HubSpot or Salesforce on a Tuesday morning and discovers four identical deals for a £12,000 commercial equipment enquiry, all created within three minutes. Two sales reps have already emailed the customer, while the pipeline report overstates weekly forecasted revenue by £36,000. Engineering confirms that the website form worked, the database is healthy, and the CRM integration returned a string of HTTP 504 Gateway Timeout errors during a brief server spike.
This breakdown occurs because web integrations communicate over fallible network connections where a failed request does not mean the underlying work failed. When a webhook sender receives an HTTP 504 timeout, it assumes the destination server never processed the payload. Without an idempotency key tied to a unique form submission identifier, every automated retry creates a fresh deal record inside your pipeline.
The mechanics of an HTTP 504 timeout and the retry trap
When a visitor submits a quote request, the website dispatches a webhook to the CRM endpoint or middleware like Zapier or Make. A reverse proxy sits in front of the receiving server to enforce timeout boundaries, typically set between 15 and 30 seconds. If the CRM database is busy, or if automation rules fire synchronously upon deal creation, execution time exceeds that threshold. At second 30, the proxy terminates the open socket and returns an HTTP 504 Gateway Timeout status code to the sender.
Crucially, terminating the client HTTP connection does not cancel the background database transaction. The CRM worker often finishes writing the deal record moments later. From the CRM database perspective, the deal succeeded. From the webhook sender perspective, the transaction failed completely.
Modern webhook dispatchers handle network drops by retrying payloads using exponential backoff, resending after 30 seconds, then two minutes. Because each retry arrives as an independent HTTP request, the CRM treats each attempt as a brand new transaction, inserting duplicate deal records before returning an eventual HTTP 200 OK confirmation.
Tracing the financial fallout across automated retry cycles
Say you receive an inbound trade finance application worth £12,000 (illustrative numbers, not a client's). The table below traces what occurs at each stage of a standard 30-second gateway timeout loop.
| Dispatch Attempt | Gateway Response | Actual CRM Database State | Pipeline Deal Count | Artificially Reported Pipeline Value |
|---|---|---|---|---|
| Initial POST at 14:02:10 | HTTP 504 Gateway Timeout (30s) | Deal record inserted into CRM table at 14:02:32 | 1 deal created | £12,000 (accurate value) |
| Automated Retry 1 at 14:02:42 | HTTP 504 Gateway Timeout (30s) | Second deal record inserted at 14:03:04 | 2 duplicate deals | £24,000 (£12,000 phantom revenue) |
| Automated Retry 2 at 14:04:45 | HTTP 200 OK (processed in 4s) | Third deal record inserted at 14:04:49 | 3 duplicate deals | £36,000 (£24,000 phantom revenue) |
| Manual User Resubmit at 14:05:15 | HTTP 200 OK (processed in 3s) | Fourth deal record inserted at 14:05:18 | 4 duplicate deals | £48,000 (£36,000 phantom revenue) |
| Final Reconciled Pipeline | All network payloads accepted | 4 separate deals with identical form payloads | 4 active deals | £36,000 artificial pipeline inflation |
In this scenario, a single qualified prospect generates four active commercial opportunities. Two automated retries and one impatient user click multiply the commercial footprint by four. Round-robin assignment rules allocate deals to competing reps who send conflicting outreach to the buyer, while marketing attribution models record four conversions, artificially lowering reported cost per acquisition.
Diagnostic patterns: identifying timeout and idempotency failures
Duplicate CRM records generated by network timeouts display distinct operational signatures:
| CRM Pipeline Symptom | Underlying Webhook Failure | Operational and Commercial Consequence |
|---|---|---|
| Identical deals created two to five minutes apart with identical values | Synchronous CRM automations cause HTTP 504 timeouts, prompting automated retries | Pipeline forecasts inflate and sales reps contact the same prospect |
| Instant notification emails fire multiple times for one customer form fill | Dispatcher retries on disconnect while previous executions finish in background | Prospects receive conflicting confirmations, damaging commercial credibility |
| Inbound deals arrive with identical contact data but distinct CRM object IDs | Endpoints create records without checking a unique submission identifier | Account executives waste time manually deleting records and merging deal histories |
| Deal conversion rates spike while closed-won revenue remains flat | Retries multiply top-of-funnel lead counts while actual buyer volume remains unchanged | Commercial conversion velocity metrics distort, masking true sales pipeline health |
| Webhook queues back up during traffic peaks with rolling 504 errors | Heavy database triggers on deal creation block incoming API connections | Inbound lead flow stalls, delaying time-critical sales responses to buyers |
When investigating these issues, the primary clue is timestamp progression. If duplicate deals appear with identical fields and timestamps separated by standard retry intervals, the problem is an unkeyed retry cycle.
Why idempotency keys solve the duplicate deal problem
An API operation is idempotent if making the same request multiple times produces the exact same server state as making it once. Querying a customer with an HTTP GET request is naturally idempotent: running it ten times changes nothing. An HTTP POST request that creates a deal is not naturally idempotent: running it three times creates three distinct database rows.
To achieve idempotency, the client application must attach a unique idempotency key to the payload. In web form integrations, the most reliable key is a unique submission identifier generated on the client or web server at submission time (such as a UUIDv4 string, e.g. submission_id).
When the CRM API or middleware receives the request, it checks the incoming submission_id against a fast key-value store or staging table:
- If the key is new, the server records it as processing and creates the deal.
- If the request timed out after 30 seconds and the dispatcher retries with the same
submission_id, the server detects that the record exists or is in progress. - The server discards the duplicate write and returns an HTTP 200 OK status containing the original deal ID.
By enforcing an idempotency contract, network timeouts become harmless. A webhook dispatcher can retry repeatedly across an unstable connection, yet your CRM will never contain more than one deal record for that submission.
Engineering resilient CRM handoffs
Preventing duplicate deals requires decoupling data ingestion from heavy backend processing. If your CRM endpoint attempts to validate contact details, check credit databases, and fire alerts within a single synchronous HTTP request, it will trigger HTTP 504 timeouts during busy trading periods.
A resilient integration architecture adopts an asynchronous pattern:
- Fast acknowledgement: The receiving endpoint validates the schema, writes the payload with its idempotency key to an ingestion queue, and returns an immediate HTTP 200 OK status within 200 milliseconds.
- Asynchronous workers: Background worker queues pull jobs at a controlled pace, creating CRM deals and firing downstream notifications without holding open an active HTTP socket.
- Database constraints: The CRM itself should enforce uniqueness where possible. Mapping
submission_iddirectly to a unique external ID field ensures the database rejects duplicate inserts at the storage layer.
Frequently asked questions
What is the technical difference between an HTTP 504 timeout and an HTTP 500 error in webhooks?
An HTTP 500 error indicates an unhandled server crash, halting execution immediately. An HTTP 504 timeout means an edge proxy terminated the socket connection while waiting for an upstream database or application server to finish. In a 504 scenario, the backend script frequently keeps running and completes the database insert after the client has disconnected, making blind retries dangerous.
Where should the idempotency key be generated during a website form submission?
The idempotency key should be generated at the earliest possible stage, ideally by the browser client or initial form-processing server. Generating a unique UUID on form submit ensures that all retries, proxy retransmissions, and middleware steps carry the identical transaction identifier. Generating keys later inside middleware creates fresh IDs on each attempt, defeating the deduplication check.
Can CRM workflow deduplication replace technical API idempotency keys?
Standard CRM deduplication rules based on email or phone cannot replace API idempotency keys for deals. While CRMs can prevent duplicate contacts, they routinely allow multiple open deals per contact to support legitimate repeat quotes and projects. Without a unique submission identifier on each deal payload, the CRM cannot distinguish between a genuine second enquiry and an automated retry duplicating an existing deal.
Auditing and stabilising your customer data pipelines
If your commercial reporting suffers from duplicate deal records or unmonitored webhook retries, the cause is an integration contract that treats network connections as infallible. We review integration architecture and audit payload handoffs through our customer data systems practice, our data integration consultancy, and our data cleansing services. You can explore system ownership in when a trade customer sees the wrong price, review metric governance in defining the decision before building a dashboard, or inspect our full analytics scope under customer analytics.