opennextjs-netlify: [Bug]: __netlify-handler function times out

Summary

After upgrading from version 3.9 to 4.2.1, the site builds properly but after when visiting the page, it times out and gets a 502 error from the __netlify-handler function. It gives back the following error -

{"errorMessage":"2022-01-28T15:53:17.566Z dcfe2e2a-53a5-44ef-a864-61fd6b598654 Task timed out after 10.01 seconds"}

The same version of the code was working fine with the version 3.9. The logs for __netlify-handler only show a timeout error and there is no other info which can be used for debugging.

Steps to reproduce

.

A link to a reproduction repository

No response

Plugin version

4.2.1

More information about your build

  • I am building using the CLI
  • I am building using file-based configuration (netlify.toml)

What OS are you using?

No response

Your netlify.toml file

`netlify.toml`
[build]
    command = "npm run build"
    publish = ".next"

[context.production]
    environment = {NEXT_PUBLIC_API_URL=""}

[context.deploy-preview]
    environment = {NEXT_PUBLIC_API_URL=""}


[[plugins]] 
    package = "netlify-plugin-cypress"

[[plugins]]
package = "@netlify/plugin-nextjs"

[build.environment]
CYPRESS_CACHE_FOLDER = "../node_modules/.CypressBinary"
TERM = "xterm"

Your public/_redirects file

`_redirects`
# Paste content of your `_redirects` file here

Your next.config.js file

`next.config.js`
# Paste content of your `next.config.js` file here. Check there is no private info in there.

Builds logs (or link to your logs)

Build logs
# Paste logs here

Function logs

Function logs
8:09:12 PM 5e752d92 Duration: 10008.16 ms	Memory Usage: 275 MB	Init Duration: 186.18 ms
8:09:12 PM 5e752d92 ERROR  Task timed out after 10.01 seconds
8:09:21 PM 7b5ea894 Duration: 10007.95 ms	Memory Usage: 271 MB	Init Duration: 211.42 ms
8:09:21 PM 7b5ea894 ERROR  Task timed out after 10.01 seconds
8:51:25 PM e17c41f2 Duration: 10008.26 ms	Memory Usage: 271 MB	Init Duration: 229.31 ms
8:51:25 PM e17c41f2 ERROR  Task timed out after 10.01 seconds

.next JSON files

generated .next JSON files
# Paste file contents here. Please check there isn't any private info in them
# You can either build locally, or download the deploy from Netlify by clicking the arrow next to the deploy time.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 7
  • Comments: 27 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Can everyone who is experiencing this problem please check if they’re using Material Icons? In @mkubdev 's reproduction it turned out that it was taking 9 seconds to require a single icon from @mui/icons-material!

If you are using Material icons, please see the usage docs for how to efficiently load them. Otherwise you will be importing all 2000+ icons every time, with serious consequences for performance.

@ascorbic great news! I confirm that importing

import AccessAlarmIcon from '@mui/icons-material/AccessAlarm';

instead of

import { AccessAlarm, ThreeDRotation } from '@mui/icons-material';

It dramatically improves the performance of the API routes 🎉💃.

It’s a really strange behavior since the API does not require (in my codebase) any icons.

PS, I have a strong suspicion that the same problem can occur with the @mui/material package

So is waay better to do this

import Button from '@mui/material/Button';

instead of

import { Button } from '@mui/material';

StackOverflow link

@ascorbic

same as @phillippbertram image image image

No logs are shown on the https://app.netlify.com/sites/{{yoursite}}/functions/___netlify-odb-handler section

(lattanabooks) in my case

ps. obviously I run some lambda during this range of time 😢

I also have the same issue 😞 with the latest version v4.2.7. Unfortunately, there are no logs generated for ___netlify-odb-handler I could provide you 🤷

Like everyone here, we have the same problem on a private codebase i can’t share, with 4.3.0

  • Netlify fail to request Mongodb Atlas and i get a timed out message.

Dev build, the request take 919.62ms : image Production build, request take 25ms : image

  • Vercel is working fine.

And as @cosimochellini and @phillippbertram, no logs in every serveless function instead of the timed out message.

@ascorbic update: with 4.3.0 the behavior is the same, No logs on netlify logs, same error on api side {"errorMessage":"2022-01-28T15:53:17.566Z dcfe2e2a-53a5-44ef-a864-61fd6b598654 Task timed out after 10.01 seconds"}

Same problem here with cal.com open source project.

You can test it with the fork that I’ve successfully deployed to Netlify (just added a .env to prevent build failing) here: https://github.com/Pin-Pon-dev/cal.com

The official guide recommends Vercel and no issues are reported about this problem AFAIK (not tested myself).

Can anyone who has this issue please share the function logs for ___netlify-odb-handler please

I have the same issue 😢 https://github.com/cosimochellini/aws-share-files

On vercel has no problem

On netlify goes on timeout