You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Been playing around with Remix and Trigger.dev hosted on Vercel building with Vite. There are a lot of weird stuff that needs to be changed to make it all work and hopefully someone else will have use for this post and can help improve the caveats.
To make Trigger.dev jobs work you need to modify your jobs similar to this:
~/routes/api.trigger.ts
import{typeActionFunctionArgs,json}from'@vercel/remix'import{triggerClient}from'~/backend/clients/triggerClient'// path to your trigger.dev clientexportasyncfunctionaction({ request }: ActionFunctionArgs){awaitimport('~/jobs/myJob1.server')awaitimport('~/jobs/myJob2.server')...constresponse=awaittriggerClient.handleRequest(request)if(!response){returnjson({error: 'Not found'},{status: 404})}returnjson(response.body,{status: response.status,headers: response.headers})}
As Vercel does not suport Remix / Vite + Trigger.dev out of the box you will need to set up build and deployment manually for now. I'm sure there's a way to automate this in Vercel but for now I'm sticking with simple bash scripts:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Been playing around with Remix and Trigger.dev hosted on Vercel building with Vite. There are a lot of weird stuff that needs to be changed to make it all work and hopefully someone else will have use for this post and can help improve the caveats.
This is based on feedback / discussions from:
Outstanding issues
Basically follow the guide from https://remix.run/docs/en/main/future/vite to convert your Remix project to use Vite, for a basic project this should be 1:1 mapped.
To make Trigger.dev jobs work you need to modify your jobs similar to this:
~/routes/api.trigger.ts
As Vercel does not suport Remix / Vite + Trigger.dev out of the box you will need to set up build and deployment manually for now. I'm sure there's a way to automate this in Vercel but for now I'm sticking with simple bash scripts:
Create :
~/build.sh
:~/.vc-config.json
:~/config.json
:~/app/adapters/base.ts
:~/app/adapters/vercel-serverless.ts
:And to build and deploy to PROD:
If running Trigger.dev jobs it will result in an error at the end - but the job itself is executed. TBD to figure out why it gives an error back.
Beta Was this translation helpful? Give feedback.
All reactions