Large number of Sanity API requests seemingly caused by Netlify

Hello,

I’m having problems with my site (effulgent-longma-42da54), which was transferred to me from another developer at the beginning of April.

The project is using Sanity, which reports a huge spike in monthly API requests going from no more than an average of 10 - 20k in the past all the way up to 330k now on the 20th of this month. This also causes an increase in cost.

According to the Sanity logs, it seems like Netlify is the cause of this - calling the Sanity API dozens of times every minute.

In the Netlify logs I found a running function throwing the following warnings and errors with a suspiciously similar frequency.

I can find neither the source of this function nor the corresponding directory.

From my understanding, none of the changes I have made should have resulted in such a behaviour. However, I found that changing the Node.js version under Build & deploy > Dependency management causes a fresh creation of the function.

The netlify.toml in my projects root directory looks as follows:

[build]
  base = "web/"
  command = "pnpm run build"
  publish = "dist/"
  functions = "functions"

[functions]
  node_bundler = "esbuild"

[[redirects]]
  from = "/api/*"
  to = "/.netlify/functions/:splat"
  status = 200

Due to the rising costs resulting from this issue, I’d like to resolve this as soon as possible and would greatly appreciate all the help I can get.
Thanks!

I don’t see any functions for your site. Has something changed?

Yes, I changed the build command to pnpm run generate but unfortunately the problem with the api requests persists. Let me know if you need any further information.

If the function no longer exists how does the problem persist. Could you share how to reproduce?