Entaro
Entaro
TTCTheo's Typesafe Cult
Created by Entaro on 10/6/2023 in #questions
Safely screen requests to pages/api for cron jobs with Vercel
So I've setup my app using create-t3-app and am trying to using vercel cron jobs to send out emails every so often. Basic structure would be to setup pages/api/cron.ts to call a function in server/api/sendEmails.ts. But how do I ensure that not anybody can just send a request to cron.ts and fire off an email blast? I have a couple of webhook endpoints in "pages/api" that verify the source of the request for either stripe or clerk using functions provided by each service, but I'm unsure how to do something like that on my own. Any tips/suggestions on if this is even the right approach?
2 replies
TTCTheo's Typesafe Cult
Created by Entaro on 4/20/2023 in #questions
Unable to invoke prisma mutation to planetscale dev branch.
Dev branch was created on planetscale and the env variables are set to dev branch values.
npx prisma db push
npx prisma db push
works fine and succeeds. Looking at planetscale the new tables/fields are created but when I go to try to invoke the prisma mutation I get the error:
❌ tRPC failed on upload.uploadData:
Invalid `prisma.order.create()` invocation:


Error querying the database: Server error: `ERROR HY000 (1105): unavailable: unable to connect to branch BRANCH_NAME_HERE'
❌ tRPC failed on upload.uploadData:
Invalid `prisma.order.create()` invocation:


Error querying the database: Server error: `ERROR HY000 (1105): unavailable: unable to connect to branch BRANCH_NAME_HERE'
Also for whatever reason in the console on planetscale it says there's a syntax error when typing:
SELECT * FROM Mytable;
SELECT * FROM Mytable;
Any idea what's going on?
15 replies