Function Invocation usage in Nextjs I don't understand

I got a message saying I’m at 90% function invocation. I’m new to nextjs (which is what I’m using) and I’m not sure how that happened. I suspect it’s some _middleware I just put in, but I don’t know how it spiked so much. (My understanding is that that would only happen on requests and it seems unlikely there were 100K to my little site.)

Are there logs I can make/look at to try to see what’s up?


  • alan
1 Like

I’ve pulled out the middleware files and as far as I know, I don’t have any other functions running. But I’m still seeing what I think are invocations on this page (which is what I was looking for in the original post, I think):

There are constant log hits that look like this:

12:57:43 PM: db945b2d Duration: 3.46 ms Memory Usage: 102 MB
12:58:09 PM: 8418575a Duration: 4.52 ms Memory Usage: 102 MB
12:58:10 PM: 7f525ba4 Duration: 3.88 ms Memory Usage: 102 MB
12:58:11 PM: 6ed7ff4e Duration: 4.60 ms Memory Usage: 102 MB
12:58:12 PM: 192ab17c Duration: 3.46 ms Memory Usage: 102 MB
12:58:13 PM: 921796c4 Duration: 7.93 ms Memory Usage: 102 MB
12:58:39 PM: 68511384 Duration: 3.49 ms Memory Usage: 102 MB
12:58:41 PM: 4aee1615 Duration: 3.41 ms Memory Usage: 102 MB
12:58:42 PM: 563447bc Duration: 3.27 ms Memory Usage: 102 MB

I added a DEBUG env variable with a * value to see if more info would show up, but nothing changed.

I have no idea what could be causing behavior.

If it matters, my site is built off this starter from cassidoo:

Any ideas?

  • a

P.S. I did a clear cache and re-deploy thing too but that didn’t clear the issue.

Do you use any dynamic rendering? That is all function driven, so if you do, we’ll be creating functions to do the rendering for you, and running them automatically.

I don’t think so. And, to make sure. I took everything off the site except an pages/index.js file with nothing but a single div with placeholder text and still saw the function firing.

It wasn’t as frequent as when the full site was live, but it was still going.

Could you try upgrading to Next v12.0.4? There was a bug which was fixed 2 days back, which should solve this.

I ran a test with 12.0.4 and I’m still seeing function calls.

Specifically, I pulled down a fresh copy of Cassidoo’s starter repo (GitHub - cassidoo/next-netlify-starter: A one-click starter project for Next and Netlify) which is what mine is based off of

  • I upgraded it to next 12.0.4 and “@netlify/plugin-nextjs”: “^4.0.0-beta.7” and deployed it here:

  • It looks like everytime the home page is accessed the ___netlify-handler function fires.

(I’m new to nextjs, so maybe this is expected behavior(?) but I didn’t think hitting a basic page like that would trigger a function.)

Hi @TheIdOfAlan ,
Yes, that is expected behavior. Every SSR page will hit the handler. Currently, in the beta plugin every page hits the function, even static ones, though this will change so that static pages will be served from the CDN. You can enable that now by setting the env var EXPERIMENTAL_MOVE_STATIC_PAGES

1 Like

Right on, I’ll give that a try. What value to I need to set for EXPERIMENTAL_MOVE_STATIC_PAGES to enable it?

Like 1 or TRUE or something?

Either is fine. Anything truthy