Invocations usage on nextjs redirects

Hi,

We have only moved our CSR app from React to Nextjs. We have setup redirects and don’t use any function invocations. But netlify is considering every link as a function invocation. Why is this happening and how do I fix it?

Hey there, @360 :wave:

Welcome to the Netlify Forums and thanks so much for reaching out. We will need a bit more information in order to look into your situation. Can you please share a link to your site, your most recent deploy log, as well as your project repo?

deploy log:

1:27:06 AM: Page                                       Size     First Load JS
1:27:06 AM: ┌   /_app                                  0 B             143 kB
1:27:06 AM: ├ ○ /404                                   197 B           143 kB
1:27:06 AM: ├ ○ /app                                   35 kB           197 kB
1:27:06 AM: ├ ○ /login                                 3.27 kB         238 kB
1:27:06 AM: ├ ○ /pro-login                             3.41 kB         265 kB
1:27:06 AM: ├ ○ /pro-signup                            3.6 kB          266 kB
1:27:06 AM: └ ○ /signup                                3.47 kB         239 kB
1:27:06 AM: + First Load JS shared by all              143 kB
1:27:06 AM:   ├ chunks/framework-79bce4a3a540b080.js   42.1 kB
1:27:06 AM:   ├ chunks/main-67bb79a0c8f1a418.js        31.9 kB
1:27:06 AM:   ├ chunks/pages/_app-9d31abc696255283.js  64.9 kB
1:27:06 AM:   ├ chunks/webpack-df1cf20f7f378f82.js     3.78 kB
1:27:06 AM:   └ css/2f7ce6c5ae0d29b6.css               17.6 kB
1:27:06 AM: ○  (Static)  automatically rendered as static HTML (uses no initial props)
1:27:06 AM: Done in 40.27s.

you can see that there are no links that belong to the server-side

hey there 360,

thanks for sharing that. Where are you seeing that Netlify is considering every link as a function invocation? I’m not sure I follow, can you explain in a different way?

The function logs show all the redirects as SSR

Mar 20, 01:11:05 AM: b0a02455 INFO   [GET] /view/1972463 (SSR)
Mar 20, 01:11:05 AM: b0a02455 Duration: 4.52 ms	Memory Usage: 116 MB	
Mar 20, 01:11:24 AM: e51f5978 INFO   [GET] /profile/langley (SSR)
Mar 20, 01:11:24 AM: e51f5978 Duration: 4.17 ms	Memory Usage: 116 MB	
Mar 20, 01:11:38 AM: 1bb97794 INFO   [GET] /virtualtour/50918a52 (SSR)
Mar 20, 01:11:38 AM: 1bb97794 Duration: 12.54 ms	Memory Usage: 117 MB	

all the links redirect to ‘/app’ in next.conifg.js for ex:
{
source: ‘/profile/:username’,
destination: ‘/app’,
},

Hey @360,

If you post in the helpdesk as well as the forums, please mention that you’ve posted on the other platform so we can try to link the cases, or else you’d be having two different conversations and you might also end up getting repeated suggestions.

@perry and @hillary don’t check or respond in the helpdesk, so they won’t know you’ve opened a ticket there. I got to know only because I personally worked on this ticket in the helpdesk, if someone else had done that, I’d still not have known and continued to debug accordingly.

We’ll keep discussing this in the helpdesk (unless you wish to switch to the forums).

Hi Hrishikesh ,

We just want the solution to the issue. Doesn’t matter if it’s on helpdesk or forum. @perry and @hillary I would really like your inputs too. Its taking too much time to resolve this.

Hey @360,

I believe we sorted this out in the helpdesk.

For anyone coming back to this in the future, the problem was caused because they had redirects inside their next.js config. These requests are always sent to SSR so avoid using that for redirects that are possible with Netlify redirects.