Next runtime SSR function is crashing when hitting a preview link for my CMS

I am building a Next.js app with page router and I am trying to connect it to Storyblok CMS . Locally everything worked correctly but when I uploaded it to netlify, when I tried to enter the route where I was serving the static props got me an error with the SSR function handler. It was crashing due to a timeout in my Next.js app.

After reading through multiple forums chats and github threads I found out that changing the next.js runtime plugin and the next.js version could help . I end up with 13.4.19 on next.js and for @netlify/plugin-nextjs the 4.41.3. This worked in first instance. Now the I wanted to activate preview mode, without it is very difficult for a client to work in a static way. I was following this tutorial. When trying to access the route the SSR function handler correctly intercept the call but I have the same crashing issue as mentioned before. I must say all the next builds, build correctly. Here is the log of what I am seeing:

Mar 7, 04:42:59 PM: 03f45e64 ERROR Task timed out after 10.02 seconds

Mar 7, 04:42:59 PM: 03f45e64 Duration: 10021.94 ms Memory Usage: 283 MB

Mar 7, 04:42:59 PM: INIT_START Runtime Version: nodejs:20.v18 Runtime Version ARN: arn:aws:lambda:us-east-1::runtime:b8c2913782bf648152634d2f893a4c02250aec5884edb545f64c2bd7268d214e

Mar 7, 04:43:00 PM: 72881085 INFO - info Loaded env from /var/task/.env.local

Mar 7, 04:43:02 PM: 72881085 INFO account

My site is under an authentication wall, that’s why i can’t send you a repro example.

Have you checked:

Yes, I did it checked, in the end what help me out was increasing the function time. :confused:

glad to hear it, Thanks for writing back in.

Hey @SamO thanks for answering me. So even though my page don’t longer break ( because the increment in the function timing ) I was doing some tests with my CMS and I looked that everytime I hit my page the api request counter went up. This is weird cause I SSG this page:

and when I look at the function logs I could see calling this page was triggering the SSR handler :
. Uhm I am missing something ? Shouldn’t data been load at build time rather than at runtime with the function?

Hard to say without seeing the site, but you can try switching to Next.js Runtime v5 (if you upgrade to Next.js 13.5+) to see if it solves your issue.

It seems Next.js runtime v5 is not 100% stable? I watched the releases on github and it seems is not the lastest version. I will not want to break the client app. Uhm anyways I am just using a page with “getStaticProps”, I don’t know if I can share you somehow my website ( if possible not over here, it will be better over email )

Not sure which software ever is :slight_smile:

But it’s much more robust than v4 for Next.js 13. It’s your best path forward.

:joy: good point. Thanks then! I will update to v5!

1 Like