We build a sync platform that allows our users to sync data from internal databases, warehouses, and spreadsheets into CRMs like Hubspot. For Hubspot we do this using a combination of the Search API (to determine if something already exists, and if so what it’s ID is), and the bulk import APIs.
We noticed today that one of our users was having trouble syncing to Hubspot and have tracked the problem down to Cloudflare returning 403 repsonses after we send ~ 150 search requests. We’re managing our rate limits and should be well below the search rate limit -- we currently do at most 1 request per second.
Are there additional limits for the search API we should be aware of?
Is there anything we can do to decrease the likelihood of a Cloudflare 403 response?
If we get one of those responses, is there a recommendation for how long to back off from making further requests? Right now we’re doing exponential backoff starting at 10sec, up to 10min between requests, and things still seem to be failing.
We’re using OAuth to authenticate requests if that makes a difference.
This does not seem to be consistently applied based on the request pattern alone. I’m able to successfully continue making calls from our staging instance well past the threshold where Cloudflare begins limiting me in production.
As expected, I don’t see the Cloudflare blocked calls in the Developer console; is there any way to figure out why this might be happening in production?
On another note, do be prepared for gateway errors from HubSpot. They do happen from time to time based on whatever load balancing or cloudflare setup might cause it. You’ll need some logic to retry requests when getting a gateway timeout or secondly limit (max 10 requests per second).
We’ve managed to track this down, and it was not anything on the Hubspot side.
The customer data we were dealing with contained quite a few XSS and SQL injection attempts created as part of their security bounty program. I’m relatively certain that this input is what was triggering Cloudflare, rather than the volume of requests. This is supported by the fact that even after backing off 30 minutes between requests overnight, CF still blocked the original request.
Apologies for the noise, and thanks for following up @dennisedson !