From 999f6de45f82e551a3da813fcc092e5d730f5cc3 Mon Sep 17 00:00:00 2001 From: Enrico Ros Date: Thu, 28 Mar 2024 23:12:25 -0700 Subject: [PATCH] Serverless Functions timeout: set it in the Vercel functions as the conditional was not working. Fix (again) #468 --- app/api/trpc-node/[trpc]/route.ts | 5 +++-- vercel.json | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 vercel.json diff --git a/app/api/trpc-node/[trpc]/route.ts b/app/api/trpc-node/[trpc]/route.ts index acbee864a..6a8f539b2 100644 --- a/app/api/trpc-node/[trpc]/route.ts +++ b/app/api/trpc-node/[trpc]/route.ts @@ -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 }; \ No newline at end of file diff --git a/vercel.json b/vercel.json new file mode 100644 index 000000000..024c88738 --- /dev/null +++ b/vercel.json @@ -0,0 +1,7 @@ +{ + "functions": { + "app/api/trpc-node/**/*": { + "maxDuration": 25 + } + } +} \ No newline at end of file