Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

API Routes timeout in production #46203

Closed
1 task done
kouji-dev opened this issue Feb 21, 2023 · 3 comments
Closed
1 task done

API Routes timeout in production #46203

kouji-dev opened this issue Feb 21, 2023 · 3 comments
Labels
bug Issue was opened via the bug report template.

Comments

@kouji-dev
Copy link

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: win32
      Arch: x64
      Version: Windows 10 Home
Binaries:
      Node: 16.15.1
      npm: N/A
      Yarn: N/A
      pnpm: N/A
Relevant packages:
      next: 13.1.7-canary.21
      eslint-config-next: 13.1.7-canary.21
      react: 18.2.0
      react-dom: 18.2.0

Same thing for next@13.1.6

Which area(s) of Next.js are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue

https://github.com/kouji-dev/boostgg

To Reproduce

Having deployed only the typescript template, the call to _productionUrl.vercel.app/api/hello works_, but when i added my front-end libraries and prisma to the project, all my api routes are not working anymore, and I get

An error occurred with your deployment

FUNCTION_INVOCATION_TIMEOUT

Describe the Bug

the logs are clean and there are no errors, also everything works fine in my local. I even connected to the production database from my local and the api responds in 127ms. but also testing just a dummy api route doesnt work.

// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import type { NextApiRequest, NextApiResponse } from 'next'

type Data = {
  name: string
}

export default function handler(
  req: NextApiRequest,
  res: NextApiResponse<Data>
) {
  res.status(200).json({ name: 'John Doe' })
}

I also have deployed my code in 2 diffrent regions: Paris (which is near me), San francisco which is soo far but both gives the same result.

Expected Behavior

That my api routes work in production, if it works in local. If the api is consuming a lot, vercel platform should warn me and dont interupt the call at least for the first call so that i can mesure the total resources and time needed for the api.

Which browser are you using? (if relevant)

chrome

How are you deploying your application? (if relevant)

next build

@kouji-dev kouji-dev added the bug Issue was opened via the bug report template. label Feb 21, 2023
@icyJoseph
Copy link
Contributor

icyJoseph commented Feb 22, 2023

Could it be possible that your server bundle is so large that it cannot be parsed whitin a sensible time? Could you run @next/bundle-analyzer and see what's up with the server bundles?

@kouji-dev
Copy link
Author

kouji-dev commented Feb 22, 2023

@icyJoseph thanks for your reply, i think i've found the root cause. Surprisingly it is due to @mui/icons-material, it impacts the bundle size. I will close this ticket it is related to this mui icon issue.

But i would still consider tha the DX is bad, the timeout should acctually log the reason of the timeout

@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 24, 2023
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

2 participants