Site Name: https://backstorytoday.netlify.app/
Next Js Version: 12.0.8
Node Js Version: 16 LTS
Netlify Plugins: Essential Next.js (v4) [4.1.1] (added automatically when building the app)
{"errorMessage":"2022-01-16T16:47:42.443Z 2cd1eda0-f5ac-4453-b864-005a73f0d6ce Task timed out after 10.01 seconds"}
I initially thought that the issue is maybe related to me using firestore for fetching data inside the getStaticProps or getServerSideProps functions. Then i created 2 pages https://backstorytoday.netlify.app/no-data-fetch-isr and https://backstorytoday.netlify.app/no-data-fetch-ssr with ISR and SSR respectively with no computation whatsoever in the getStaticProps / getServerSideProps (just returning some hardcoded props) but that doesn’t seem to work also.
In the Serverless Function logs i receive logs like
10:04:07 PM: 0fd4bc4a Duration: 10009.78 ms Memory Usage: 237 MB 10:04:07 PM: 0fd4bc4a ERROR Task timed out after 10.01 seconds
No logs inside the getStaticProps / getServerSideProps are printing though.
Some static pages seem to work correctly though ex: About | BackStory
Sorry for the delay here, we have been a bit underwater this week. I took this to our team that works on the plugin, and they would like you to update to the latest version of the build plugin? There is a specific fix that went out that we believe will address this: Releases · netlify/netlify-plugin-nextjs · GitHub
Hi @hillary, thanks for the update. As per your suggestion I upgraded to the latest version of netlify-plugin-nextjs @4.2.0.
After the upgrade some pages, that were not previously getting timed out are loading properly now.
However, I got many timeouts untill about 20 minutes of the deployment, but once a page loaded, it loaded fine consistently.
@hrishikesh for the image thanks, I fixed the firestore cloud storage read rules and it worked.
For the timeouts it is kind of inconsistent, some pages that were working earlier have suddenly stopped working. The wierdest being the 404 page https://backstorytoday.netlify.app/404 . This is a static page with no data being fetched at all. Another page that stopped working is this test page https://backstorytoday.netlify.app/no-data-fetch-ssr . This one is an SSR page with no data being fetched also.
This is my page build output section from the latest deployment
As you can see, the maximum build time is < 2 seconds so i don’t think there would be a real timeout (10s) issue from my end. Let me know if you need any other info.
Yes, the timeout is not from your end, but Netlify’s end. Next.js requires Netlify functions for some actions, and Netlify Functions have a run time limit of 10 seconds by default. That’s where the error is coming from.
I checked this further, and this is kind of weird. I’m not too well-versed with Next.js, so I might be wrong, but here is what I found:
According to those 2 lines, it makes me think that the 404 page is indeed a static page. So, it should exist as 404.html in your site. Except, it doesn’t.
As you can see, for other static pages like /about, /admin, etc. there’s a page with [name].html in your deploy. There’s no such 404.html page.
The plugin has ended up adding a redirect rule for the 404 page:
/404 /.netlify/functions/___netlify-handler 200
So, 404 page is also sent to the function (in spite of Next.js saying that it’s a static page). Now, I don’t know if this is expected or not. I’ll try to ask the developers, but meanwhile if you could confirm if this is expected when using Next.js, that would be great.
Sorry about the delay. We tried to discuss this with our engineers today and they’ve some concerns about the stuff that’s happening with Firebase. Would you be able to add some log statements at each stage in your _app.tsx and _document.tsx to see where it might be taking time?
We had a talk with the engineers, but the reason for the timeout is not certain. There doesn’t seem to be any obvious cause there, so we’re at a loss to explain it.
About the image issue though, it’s a known issue that any image with the query parameter in the source URL will have the same issue. So, if you remove the query params from the source, it should work.
For the image issue I had already mentioned in one of my earlier replies that it was an issue with firestore cloud storage read rules and i was able to get it to work with the URL parameters.
But since the main issue is not resolved I guess I will have to maybe move the app to a proper Node JS Server runtime.
A last try you could give is to try updating to version 4.2.4 of the plugin. It made some changes with ISR and a few users reported their issues being fixed with this change, so maybe you’re in luck too.