Adding a vercel.json file broke my deployments
Unanswered
Thai Ridgeback posted this in #help-forum
Thai RidgebackOP
Hope this is the right place since there doesn't seem to be a vercel discord server
So, I tried adding a cron job to my nextjs project. I followed the doc to the letter, meaning I added an api handler with the following content:
Then added a
However, upon pushing the changes, I saw an error message on github with Vercel's icon, telling me "all checks have failed". There's a link that says "details", but clicking it does nothing.
I tried looking at my vercel deployment history and logs, to see if they had more detail, but the new commit doesn't even appear in the deployment history on vercel.
I tried removing the
I passed my
Any idea what I might have missed here? Clearly my vercel.json file is wrong, but I haven't been able to find why and what the fix would be.
So, I tried adding a cron job to my nextjs project. I followed the doc to the letter, meaning I added an api handler with the following content:
src/pages/api/cron.ts
import { doCron } from '@/server/routers/cron'
import type { NextApiRequest, NextApiResponse } from 'next'
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
if (req.headers.authorization !== `Bearer ${process.env.CRON_SECRET}`) {
return res.status(401).end('Unauthorized');
}
try {
await doCron()
res.status(200).json({ status: 'ok' })
} catch (err) {
console.log(err)
res.status(400).json({ status: 'ko' })
}
}Then added a
vercel.json file with the following content:vercel.json
{
"crons": [
{
"path": "/api/cron",
"schedule": "0 */4 * * *"
}
]
}However, upon pushing the changes, I saw an error message on github with Vercel's icon, telling me "all checks have failed". There's a link that says "details", but clicking it does nothing.
I tried looking at my vercel deployment history and logs, to see if they had more detail, but the new commit doesn't even appear in the deployment history on vercel.
I tried removing the
vercel.json file, and suddenly, the commit was deployed as usual. Then I re-created it, and deployments broke once again.I passed my
vercel.json file through both a JSON validator, and a CRON validator, just in case, but both told me everything was okay.Any idea what I might have missed here? Clearly my vercel.json file is wrong, but I haven't been able to find why and what the fix would be.
2 Replies
Thai RidgebackOP
Bump? :C
You probably should contact support or go to https://github.com/orgs/vercel/discussions since this is specific to vercel and we are unable to help as none of us are vercel employees