修复定时任务路由:将 POST 改为 GET(Vercel 定时任务发送 GET 请求)
我们的滴灌邮件定时任务运行了第一天,但没有发送任何邮件。定时任务成功访问了端点,返回了200状态码,一切看起来正常。结果发现,Vercel的定时任务发送的是GET请求,而我们将邮件逻辑放在了POST处理程序中。GET处理程序只是一个健康检查,返回了{"status":"healthy"}。三个定时任务路由中有两个存在这个问题,第三个恰好使用了GET请求,因此工作正常。
查看原文
Our drip email cron ran its first day and sent zero emails. The cron hit the endpoint, got a 200 back, everything looked healthy. Turns out Vercel cron sends GET requests, but we put the email logic in a POST handler. The GET handler was just a health check returning {"status":"healthy"}. Two of three cron routes had this bug - the third one happened to use GET and worked fine.