👋 Next.js Conf 2024: Come build, party, run, and connect with us! See all events

Tracking down excessive API requests and potential webhook integration issue.

16 replies
Last updated: Apr 14, 2021
Our API requests have skyrocketed. We're using the js client with CDN enabled, so not sure where these requests could come from. Is there a way to track down where the requests are coming from?
Apr 9, 2021, 7:24 AM
CDN requests sitting at 7k
Apr 9, 2021, 7:25 AM
You developing at the same time on the project?
Apr 9, 2021, 7:25 AM
and we haven't updated content often enough to warrant the CDN to have cleared
Apr 9, 2021, 7:26 AM
not that dataset, no
Apr 9, 2021, 7:26 AM
we have separate production and dev datasets
Apr 9, 2021, 7:26 AM
I don't think we're doing enough dev work to warrant 100k extra requests
Apr 9, 2021, 7:26 AM
Does the
sanity dataset export
affect this API usage ?
Apr 9, 2021, 7:38 AM
Interesting that your spike of activity is on the 7th of April, which coincides with the spike I am seeing on that same day of (unexpected) bandwidth usage… https://sanity-io-land.slack.com/archives/C9Z7RC3V1/p1617952768000500
Apr 9, 2021, 8:04 AM
Hey User, the following could be causing your spike:• previews
• active local development
• increased content activity (editors working in the studio)
• low incremental static regeneration settings (e.g. setting to 1s).
If you share your project id we can take a look and give you more specifics.
Apr 9, 2021, 6:04 PM
Thanks
user M
Doesn't look like development, it's going up the same amount of requests per day and over the weekend where there was no development. Project ID is
r80nmzas
I am doing a sanity export daily, but can't see how that'd be 100k requests/day.
Apr 11, 2021, 11:17 PM
Thanks, User. We’ll start looking into it.
Apr 12, 2021, 4:15 PM
Thanks
user M
- it's an insane number of API requests, I really don't think we can be responsible for it unless something is seriously wrong in our code. If there's any info you can share on who the requester is and what the queries are, that'd help us track it down in case it is us.
Apr 13, 2021, 7:12 AM
It's going mental.
Apr 13, 2021, 11:08 PM
Looks like we're hot on the heels of the problem, it's potentially an issue with our webhook integration.Suggestion: If there were some slightly more info/stats in the sanity dashboard we probably could have narrowed this down sooner. i.e. api calls per dataset instead of just project level. Top 5 or 10 queries. Top 5 requesting IPs.
Apr 14, 2021, 12:54 AM
I'll review the API usage tomorrow, but at the moment it looks like we found the cause 👍
user M
As mentioned above, more info on the API requests (even if it's limited to top 5s for developer & advanced plans) would have helped debug this a lot sooner.
Apr 14, 2021, 7:21 AM
user J
glad you’ve got it sorted. I agree that more insight into API requests would be super helpful in situations like this (and maybe help to catch problems before they blow through a plan’s limits). I definitely recommend dropping your thoughts into the ideas and feedback channel or opening a feature request on gh.
Apr 14, 2021, 4:17 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?