Image CDN pricing and high function usage on Astro site

How is the image CDN billed? Does it count as a function invocation?

I’m on a free plan and I suddenly used up half of my function invocation limit in a matter of days (64,135). It’s an astro site using the netlify adaptor, and I see images are being served through the .netlify/image path by default. Could this be the cause?

Also, even if it’s the case, I’m not sure how I would have used so many function invocations if the images are cached after transforming.

I only have one function listed in my deployment, named “ssr” and in the function logs there’s no real information about what that function is actually doing.

@jj25 I can’t answer your questions regarding function usage, but I believe there’s no defined pricing for the Image CDN yet, it was mentioned in the blog article introducing it:

Free and fair pricing
During the beta period, we’re not charging for the Netlify Image CDN. We do, however, plan to charge for Netlify Image CDN when it becomes generally available. We’ll be sure to communicate timelines clearly and our prices will be fair, including offering a generous free tier.

I don’t work with Astro myself, but the functions usage might be related to something like this:

When edgeMiddleware is enabled, an edge function will execute your middleware code for all requests including static assets, prerendered pages, and on-demand rendered pages.

I believe there’s no defined pricing for the Image CDN yet, it was mentioned in the blog article introducing it:

Thanks! Yes good to know there’s no explicit pricing yet, but I’m still keen to understand if imageCDN usage affects my function usage.

Anyway, I have disabled imageCDN in my astro config, just in case, so it now looks like this. I’ll see if the function usage seems lower from now on.

export default defineConfig({
  integrations: [],
  output: "hybrid",
  adapter: netlify({
    cacheOnDemandPages: true,
    imageCDN: false,

I didn’t have the edgeMiddleware option enabled so I don’t think that’s responsible.

However, I do have two dynamic pages with:

export const prerender = false;

  "public, max-age=60, must-revalidate"

which could be the culprit, but I’m hoping means they’re only regenerated maximum once per hour, so if that’s working correctly I don’t think that can explain my high function usage either.

On Netlify’s function logs I just see very generic messages which don’t help me understand what the function is doing, unfortunately:

Feb 8, 01:07:04 PM: INIT_START Runtime Version: nodejs:18.v20 Runtime Version ARN: arn:aws:lambda:us-east-2::runtime:...
Feb 8, 01:07:05 PM: 063473fe Duration: 105.34 ms Memory Usage: 112 MB Init Duration: 833.18 ms
Feb 8, 01:07:06 PM: 4c92cc42 Duration: 716.38 ms Memory Usage: 156 MB
Feb 8, 01:07:07 PM: a9010d2f Duration: 477.88 ms Memory Usage: 164 MB
Feb 8, 01:07:11 PM: 0c4de7f6 Duration: 41.77 ms Memory Usage: 164 MB
Feb 8, 01:08:46 PM: 982595fa Duration: 107.69 ms Memory Usage: 164 MB

I’ve changed various things now, including updating the netlify adaptor to the latest version, so if things get better it will be a bit hard to know why unfortunately, with such opaque logs.

@jj25 Nice work, hopefully it reduces the usage sufficiently.

Netlify may be able to shed some more light on what’s causing the function invocations.

I’ve found a similar sounding issue, which was fixed in a recent version of @astrojs/netlify

so I’m hoping that explains it.

@jj25 It sure looks like a possible explanation to me:

results in an endless loop of Lambdas calling themselves