Skip to content

Commit

Permalink
Serverless Functions timeout: set it in the Vercel functions as the c…
Browse files Browse the repository at this point in the history
…onditional was not working. Fix (again) #468
  • Loading branch information
enricoros committed Mar 29, 2024
1 parent 7068650 commit 999f6de
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/api/trpc-node/[trpc]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ const handlerNodeRoutes = (req: Request) =>
});

export const runtime = 'nodejs';
// noinspection JSUnusedGlobalSymbols
export const maxDuration = 25; // the Browsing module has a timeout of ~10s, so we increase 15 (default) -> 25
// NOTE: the following statement breaks the build on non-pro deployments, and conditionals don't work either
// so we resorted to raising the timeout from 10s to 25s in the vercel.json file instead
// export const maxDuration = 25;
export const dynamic = 'force-dynamic';
export { handlerNodeRoutes as GET, handlerNodeRoutes as POST };
7 changes: 7 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"functions": {
"app/api/trpc-node/**/*": {
"maxDuration": 25
}
}
}

0 comments on commit 999f6de

Please sign in to comment.