Production Timeout: The webhook callback function appears to run indefinitely, eventually causing a timeout on Vercel's serverless functions.
The example functions as expected in a local development environment.
Solution:
The issue was resolved by:
Moving the webhook route definition into the pages directory (to create an API route within Next.js).
using the next-js adapter for webhookCallback.
Possible Cause:
The original setup might not be compatible with Vercel's serverless function execution model. or Next.js app directory API routes and the std/http adapter probably are not compatible.
Description:
The webhook example provided at https://github.com/grammyjs/examples/tree/main/setups/next-node does not work correctly when deployed to Vercel. The following behaviour occurs:
The example functions as expected in a local development environment.
Solution:
The issue was resolved by:
pages
directory (to create an API route within Next.js).next-js
adapter forwebhookCallback
.Possible Cause: The original setup might not be compatible with Vercel's serverless function execution model. or Next.js app directory API routes and the
std/http
adapter probably are not compatible.