Build warning in deployment after adding vercel.json file

Hello!

I am trying to extend the max duration of my serverless functions in the api directory.

Currently I’m using next auth and export the GET/POST methods of it in the api/auth/[…nextauth] path I tried using the “export const maxDuration = 60;” but to no avail, so i tried configuring it via the vercel.json, but when i deploy i get the following error in my build logs :

I never used the pages structure but only used the app router.

My next version is the latest 14.2.5 and using the hobby plan (which according to the docs can extend the serverless functions to a max duration of 60s), this causes pages that need to access the backend api (via the auth flow using the GET/POST functions from next auth) to not load but instead show a “This serverless function timed out” error due to the fact that the backend need to cold start after a certain amount of time.

How can i fix this issue?

Hi, @cohen-tal!

What does your vercel.json look like? I think it should look something like:

{
  "functions": {
    "api/auth/[[...nextauth]].ts": {
      "maxDuration": 60
    }
  }
}

Sharing some relevant documentation for information:

It looks like this :

{
  "functions": {
    "app/api/**/*": {
      "maxDuration": 60
    }
  }
}

Thanks for sharing that, @cohen-tal.

Based on the warning message in the build log that you’ve provided, the issue seems to be related to the inability of Vercel to find the source file for _error.js, which may lead to the vercel.json configuration not being applied correctly. This could potentially be related to the timeout issues or other function configurations you’re encountering.

Do you have a _error.js file?

No I don’t have an _Error file… What should be its content and where do I need to create it in my project?