Build log · December 4, 2026

colin.chat on Trigger.dev, and the database that reset on every deploy

The third migration with the same prompt. colin.chat is a Boardy-style AI connector: a chat page plus background jobs that email people. Moving its jobs to Trigger.dev turned up something worse than a flaky cron: production had no stable database at all. Every prompt I gave the agent is below, word for word, with every pitfall, wrong turn and mistake, written up as product feedback for the Trigger.dev team.

Colin Lowenberg Agent: Claude Code (Opus 5.5) Trigger.dev SDK 4.9.1 December 3–4, 2026, about two hours
The colin.chat home page at colin.chat
colin.chat: An AI connector: a two-minute chat about what you're building, then an email intro to the right person from my events once both of you say yes.

For the Trigger.dev team

  1. Let the CLI start a run. runs list and runs get were great for checking; there's no way to start one.
  2. Fix the alert defaults. Ask Trigger drafted a "> 50 failed runs" alert that would never fire, and new projects can't alert on a failed deploy.
  3. Say what a deploy did. End it with the tasks, schedules (and next run time) and synced variables, and let schedules be deployed switched off.

All feedback from this project · Feedback across all five projects

Where it stands: steps 1–5 are done and verified. Step 7 (alerts) is half done: the failed-runs alert exists but needed its threshold fixed, and Trigger.dev can't alert on failed deploys for new projects. Step 6, the switchover, hasn't happened. The code is on a branch, not yet merged.

The project

colin.chat is a Python WSGI app on Vercel. Visitors chat with it; behind it are a few jobs that write emails: one offering top leads an intro to a sponsor company, a weekly report to each sponsor, a bounce checker, and two cold-email jobs (invites, match suggestions) that are switched off. State lives in Turso (hosted SQLite), and the leads are in MotherDuck.

Two Vercel crons drove it: /cron/offers every 15 minutes, and /cron/offer-report on Monday mornings. Both are routes on the website itself.

Before and after

BeforeAfter
Production databaseA fresh, empty Turso branch for every deploy. State (chats, opt-outs, the contact log, offer history) vanished on each deploy, and the copies were piling up toward the integration's 100-database limit (38 so far)One stable database, set by hand for Production
How often the offers job wakes96 times a day, nights and weekends included, mostly to skipA schedule in Pacific time that only runs during weekday sending hours
Who can change the dataEvery job used the website's full-access token, which can also drop tablesEach task names its login and proves it before running: read-only on live, full on the copy, rows-only on live after switchover
A failed runA line in Vercel's runtime logs, no retry, no alertA failed run, which an alert covers. A wrong or missing login also fails the run.
A second opinionNoneA copy pipeline picks who it would email one minute before each live run, and a daily compare checks one against the other
Schema setupThe job's command line ran every CREATE and ALTER on each runSkipped when every table, column and index exists; tested under a login that may not change the schema
Email safety in testingDry mode was an environment settingThe copy pipeline forces dry mode in code, and uses a "list only" mode that makes no model calls and sends nothing

The first row wasn't on the plan. The migration needed a copy of "the live data", and looking for it showed there wasn't any.

Every prompt, in order

Some of these are buttons I clicked in the agent's "next step" box, which send their label as my reply. The $ lines are commands I ran myself in the session's terminal; their output, which held tokens, was masked before the agent saw it. The project ref and account names are left out.

  1. The migration brief, pasted into another session that handed it to this one. It is quoted in full under Step 1.
  2. colin.chat / boardy clone
    trigger project ref proj_[redacted]My answer when the agent asked which repo I meant.
  3. Approve, start step 2
  4. Done, logged inAfter running turso auth login myself.
  5. Yes, walk me through itTo "fix production to use one stable Turso database first?"
  6. $ turso org switch [vercel-turso-org]
  7. $ turso db create colin-ai-prod --group [group]
  8. $ turso db show colin-ai-prod --url
  9. $ turso db tokens create colin-ai-prod
  10. i can't figure out the step 2 it won't let me untick production.
  11. still can't disconnect it from the project
  12. Yes, disconnect it
  13. Done, check it
  14. what are you trying to say?
  15. Yes, step 4
  16. $ turso db tokens create colin-ai-prod --read-only
  17. $ turso db tokens create colin-ai-shadow
  18. Done, verify
  19. Set up alerts
  20. where is the alert?
  21. let's write a blog post with a step-by-step instructions that we followed converting the site to trigger.dev, showing the improvements, and including every prompt i've said to you, and document all the pitfalls and confusion and errors and mistakes, that way we can have good product feedback for the trigger.dev founders let's update our blog post with a step-by-step including every prompt i've said to you, and document all the pitfalls and confusion and errors and mistakes, that way we can have good product feedback for the trigger.dev founders let's add a prompt to the blog post that will help other setup their migration to trigger. i'll use it on another project to test it

    commit the blog post to this repo : https://github.com/opencolin/trigger-blog

    and publish it as a github page
  22. [Two screenshots: the Logs page, and the alert I had created]Sent while the agent was writing this post. They showed where Alerts lives, and that my alert would never fire.

Step 1: Plan first, change nothing

The brief I pasted was the same one used for buildweek.ai, with "the buildweek.ai project" changed to "this project".

Show the brief as pasted
Migrate this project's background and scheduled jobs to Trigger.dev (v4 SDK), without risking the live site. Follow these steps in order, and stop where a step says to.

1. **Plan first; change nothing yet.**
   - List every job: cron functions (for example `crons` in `vercel.json`), GitHub Actions workflows that fetch or commit data, scripts run by hand (`scripts/`), and pages that fetch from slow sources when a visitor loads them.
   - For each job: what it reads, what it writes, how often it runs, how long it runs, and what happens today when it fails.
   - Say which ones Trigger.dev should run and which should stay where they are. Trigger.dev runs jobs, not the website.
   - Check Trigger.dev's current docs and pricing, and say which plan the number of schedules needs.
   - **Stop and show Colin the plan before building anything.**

2. **Build the new version beside the old one, not instead of it.**
   - Give the new pipeline its own copy of the data: a separate database schema or branch.
   - Use a database login that can read the live data but gets "permission denied" if it writes to it. Prove that with a real query.
   - Every task checks which login it connected as, and refuses to run as any other.
   - Reuse the existing job code: call it from Trigger.dev tasks rather than rewriting it.
   - Run existing Python with `@trigger.dev/python` (`python.runScript` plus the `pythonExtension` build extension).
   - Data files that a job commits to git move into a database table, served by an API route that falls back to the old file.
   - Find any job code that runs CREATE or ALTER on every run. That needs the table owner, so make it skip the setup when the tables already exist.

3. **Prove it locally before Trigger.dev is involved.**
   - Write a script that runs the same steps as the tasks, against the new copy.
   - Add a compare step: counts per section and per source, rows found on one side only, and how fresh each data file is.
   - Show Colin the comparison.

4. **Set up Trigger.dev.**
   - Colin creates the account and project himself. First run `npx trigger.dev whoami` to see whether the CLI is already logged in, then ask Colin for the project ref.
   - Use `syncEnvVars` only for the one database address the tasks need.
   - For any other secret (API tokens), tell Colin to add it in the dashboard by hand, as a Secret, with the narrowest scope that works. Never upload a token from the shell.
   - Deploy with `npx trigger.dev deploy`.

5. **Test it.**
   - The CLI can't start a run yet, so ask Colin to click Test on each task in the dashboard. Tell him exactly where it is: Tasks in the sidebar, or the Test page.
   - Verify each run by reading what it wrote in the database. Don't trust the run status alone.
   - Don't read the CLI's stored login token to call the API yourself.

6. **Switch over only when Colin says so.**
   - Then the new pipeline writes the live data, with a login that can change rows but can't drop or alter tables.
   - The old jobs keep running, but against a copy, with a login that can't write to the live data.
   - Each job refuses to run without its own login.
   - Keep the daily comparison running. Make it fail when the live pipeline hasn't refreshed in 36 hours, or drifts more than 5% from the old one, so Trigger.dev's failure alert covers it.
   - Explain how to undo the switch.

7. **Alerts.** Walk Colin through creating an alert in the dashboard for failed task runs and failed deploys. That has to be done by hand.

**Throughout:**
- Never print or commit secrets or database addresses.
- Quote values in `.env` files, because connection strings often contain `&`.
- At each step, say what you verified and what you didn't.

The session that relayed it added some background: the folder it was running in was the event-leads repo, and two other repos had been worked on that day. "This project" was ambiguous, and the brief said to ask if so.

What happened. The agent started in the leads repo, found no crons, no workflows and no schedulers, and stopped to ask instead of planning. It listed where the brief's kinds of jobs actually lived: a GitHub Action in colinslist, Vercel crons in colin-ai, and a GitHub Action in a third repo. I answered with prompt 2.

For colin-ai, the agent read the cron routes, the job functions and the last day of Vercel runtime logs (every /cron/offers call returned 200, every 15 minutes). The plan it showed me:

It also listed five risks it had found in the code. Three mattered later: the jobs send real email, so the copy must never send; links in the emails are signed, so the tasks need the website's signing secret at switchover; and the setup code reruns CREATE and ALTER whenever a hash of its own source changes, so two different code versions (Vercel and Trigger.dev) would keep triggering it.

Step 2: Build it beside the old one

The agent worked in a separate git worktree on a new branch, so my checkout and the live site were untouched. It wrote:

The login check is the part I'd reuse anywhere. Turso has fine-grained tokens, so behaviour is tested, not assumed:

def check(role):
    conn, tok = connect(role)            # refuses if the login is missing, or the copy's address is live's
    write_refused = denied(conn, WRITE_PROBE)   # an INSERT, always rolled back
    ddl_refused = denied(conn, DDL_PROBE)       # a CREATE TABLE, dropped again if allowed
    want = {'shadow': (False, False), 'live-ro': (True, True), 'live-rows': (False, True)}[role]
    if (write_refused, ddl_refused) != want:
        die(f'login is not {role}')

Then it hit the wall: the Turso CLI wasn't logged in. I logged in (prompt 4), and the agent listed the databases in the Vercel-managed Turso org.

The database that reset on every deploy

There were 39 databases. One was the integration's main database, which had never been read or written and had no tables. The other 38 were named dpl-…, one per Vercel deployment, each branched from that empty main database. Two of them matched the production deployment IDs in the cron logs. The previous production database held 2 chat sessions; the current one held none.

So every deploy started the live bot on an empty database. Nothing important had been lost yet (offers were off, and there were no opt-outs), but once offers went on, the opt-out list and the "never email the same person twice" rules would have reset with every push to main.

The agent stopped and told me. Fixing it took longer than the whole migration so far:

  1. I created a stable database, colin-ai-prod, and a token for it (prompts 6–9).
  2. The agent told me to untick Production on the integration's project connection in Vercel. I couldn't (prompt 10).
  3. It told me to disconnect the project from the integration instead. I couldn't do that either (prompt 11).
  4. It found vercel integration resource disconnect in the CLI, asked, and ran it (prompt 12). That worked first time, and the integration's variables disappeared from the project.
  5. I added TURSO_DATABASE_URL and TURSO_AUTH_TOKEN for Production by hand and redeployed (prompt 13).

The agent then checked: colin-ai-prod had the app's 17 tables and its schema version after one page load, and no new dpl-… database appeared for that deploy.

Then the copy: colin-ai-shadow, made from colin-ai-prod, plus a read-only token on live and a full token on the copy, written straight into a gitignored file and never printed. The proof the brief asked for, a real INSERT with the read-only login, came back with:

OperationalError Operation was blocked: SQL write operations are forbidden (current session doesn't have write permission)

Step 3: Prove it locally

sh trigger/local.sh runs the same steps as the tasks: check both logins, refresh the copy, record its picks, compare.

SponsorWaveLiveCopy
Sponsor A101
Sponsor B101
Sponsor C101
Total03

The pipeline works end to end, and the comparison is meaningless for now. Live offered nobody because offers were never turned on in production: there was no setting for it in Vercel, so the app used its default, off. The agent found that by listing the project's variable names. A drift check needs live to produce something, at least in dry mode, before switchover.

It also confirmed nothing was sent (the copy's outbox, offers and held tables were empty) and live was unchanged.

Step 4: Deploy

npx trigger.dev deploy built and deployed version 20261204.1 in a few minutes. Only the copy's address went through syncEnvVars. For everything else the agent gave me a table: the live address, TENANT, and three Secrets (a read-only token on live, a token for the copy, and a MotherDuck read-scaling token). I made the Turso tokens myself (prompts 16–17) and pasted them into the dashboard.

Step 5: Test

I clicked Test on four tasks. The agent checked each one against the databases, and read statuses with npx trigger.dev runs list and runs get:

TaskStatusChecked in the database
check-loginsCompleted, 5 sNo probe rows or probe tables left on either side
refresh-shadowCompleted, 15 sA new refresh row in the copy
shadow-offersCompleted, 35 sA refresh, then three picks, one per sponsor
offersFailed, on purpose[guard] REFUSED: live-rows needs LIVE_DATABASE_URL and LIVE_ROWS_TOKEN; this job has no login of its own. Live unchanged.

Step 6: Switch over

Not done yet. It waits on turning offers on in dry mode in production, so the compare has something to measure, and on a preview build proving Vercel ignores the Trigger.dev files.

Step 7: Alerts

Alerts are under Observability in the sidebar, per environment. I created one with Ask Trigger, the dashboard's assistant. It came out as "Failed runs above 50 on all runs": more than 50 failed runs in 10 minutes. For jobs that run a few times a day that never fires, even though its counter already showed my test failure (1 / 50). The fix is to edit the threshold to more than 0.

There's no way to alert on a failed deploy in a new project. The docs list "Deployment failure" only as a legacy alert, with its replacement "Coming soon".

Pitfalls, confusion, errors and mistakes

Feedback for Trigger.dev

High The CLI can't start a run

Every test needed me to click in the dashboard. In an agent-driven migration this is the one step that stops and waits for a human, and the agent can't retry on its own after a fix. runs list and runs get were excellent for checking results; there's just no way to start one.

Ask: trigger.dev trigger <task-id> --payload '{}' --env prod, with the same permissions as a dashboard Test.

High An Ask Trigger alert that would never fire

The assistant drafted a failed-runs alert with a threshold of more than 50 in 10 minutes. The project runs a handful of jobs a day. Nothing on the page says "this will never fire for your volume", and the counter showing 1 / 50 reads like it's working.

Ask: default "any run failing" to a threshold of more than 0, or size the default from the project's real run volume.

High No failed-deploy alert for new projects

The docs list "Deployment failure" as a legacy alert with "Coming soon" for its replacement, and say legacy alerts only appear if you already have them. A brand-new project can't be told its deploy failed, except by watching the terminal. The agent misread this at first and told me to create one.

Ask: a deploy-failure alert in the new system. Until then, one sentence on the Alerts page: "Deploy failures can't be alerted on yet."

Medium Where is Alerts?

The docs say "the Alerts page in the dashboard" but not where. It's under Observability, which my sidebar had scrolled past. My prompt 20 was literally "where is the alert?". The agent couldn't answer from the docs either and guessed.

Ask: name the sidebar section in the docs, and print a link to Alerts at the end of the first deploy, next to the Test link.

Medium The deploy log has no summary

The deploy prints hundreds of Docker layer lines, then "Deployment completed successfully" and a Test link. It doesn't say which tasks it found, which schedules it created or changed, or which variables syncEnvVars set. The agent kept only the tail of the log and couldn't tell me whether the one synced variable had arrived. I had to check by hand.

Ask: a closing summary: tasks, schedules (with the next run time), and synced variable names.

Medium Schedules go live the moment you deploy

For "build it beside the old one" you want to deploy, test by hand, then turn schedules on. Declarative schedules can't be disabled in the dashboard, so the agent worked out when each would first fire (8:14 the next morning) and relied on the login check to refuse anything early.

Ask: active: false on schedules.task, or deploy --schedules=off.

Medium python.runScript behaviour is only in the source

The docs don't say a non-zero exit throws. It does, with the script's stdout and stderr in the error, which the agent found by reading the package. That's the right behaviour, but it means anything a script prints on failure ends up in the run's error and logs, so print carefully. It's also not stated that scripts globs copy any file, not just .py; we needed config folders too, and it worked.

Ask: document both, and the image's Python version.

Low Smaller things

  • https://trigger.dev/docs/python is a 404.
  • Three UndefinedVar Docker warnings on every deploy ($SSL_CERT_FILE, $REQUESTS_CA_BUNDLE, $PIP_CERT). They aren't ours and they look like a problem.
  • syncEnvVars is built for secret stores. Syncing one plain address took a whole build extension.
  • The Free plan's one alert destination and one day of logs are tight for a job that sends email.

Worked well Worth keeping

whoami; the deploy printing a direct link to the Test page; runs list and runs get, which let the agent verify runs without touching my token; the Python running the app's existing command line unchanged; per-task maxDuration and retries for jobs that must not repeat a send.

Not Trigger.dev, but it cost the most time

  1. Vercel's Turso integration gave every production deployment its own empty database. Production state reset on each deploy, and the database count was heading for the integration's 100 limit, after which deploys could fail.
  2. The dashboard wouldn't let me take Production off the integration, untick it or disconnect it. The CLI did it in one command. A CLI fallback is worth looking for before a third round of "click here".
  3. Disconnecting also took the database away from preview deploys. Chats on preview links fail until preview gets its own variables.
  4. Offers had never been switched on in production. Every 15-minute cron run was a no-op, so there was nothing real to compare against.
  5. Turso's CLI wants the org's slug, not its display name. turso org switch personal didn't switch; the slug did.

Mistakes the agent made

  1. It started in the wrong repo. The brief said "this project" and the session was in the leads repo, which has no scheduled jobs. It asked rather than guessed, which cost one round trip and saved a wrong plan.
  2. It gave dashboard steps for screens it had never seen. "Untick Production" and "Disconnect" came from general Vercel docs, and neither worked. It should have looked for the CLI command first.
  3. It said "I'll pick up the checks automatically as soon as the build finishes" and stopped. I asked "what are you trying to say?". Waiting on a background job, it should have said plainly that the redeploy was still building and nothing was checked yet.
  4. It told me to create a "Deployment failure" alert before reading closely enough to see new projects can't.
  5. It kept only the last 40 lines of the deploy log, so it couldn't confirm the synced variable.
  6. It told me Alerts was "in the left sidebar" without knowing where. My screenshot settled it.
  7. It said it had switched the Turso CLI back to my personal org when the first attempt had silently failed. It caught that on the next check and fixed it.

Confusion

Still open at the time of writing

A prompt you can reuse

The brief from Step 1, rewritten with everything this run taught: find the real live data first and prove it persists; check the job does anything in production; jobs that send email never send from the copy; the alert threshold; no deploy alerts; and screenshots before UI directions. It's also at migration-prompt.txt if you'd rather fetch it.

Migrate [PROJECT]'s background and scheduled jobs to Trigger.dev (v4 SDK), without risking the live site.
Follow these steps in order, and stop where a step says to. I may be on my phone: put every question and its
choices in your message as plain text, and give every command I should paste in its own code block.

0. Find the right project and the real live data. Change nothing.
   - Confirm which repository and which deployed project I mean. If the folder you start in has no scheduled
     jobs, say so and ask; don't plan for the wrong repo.
   - Find where production actually stores its data, and prove it persists. Read row counts (counts only) in
     the database production is using now, and check whether the hosting integration gives each deployment its
     own database branch. (On Vercel, the Turso integration gave every deployment, production included, a fresh
     empty branch, so the site lost its state on every deploy.) If the live data doesn't persist, stop and tell
     me before anything else.
   - Check the settings that turn the jobs on or off in production (for example a feature flag that defaults
     to off). A job that skips every run can't be compared with anything; tell me what it would take to make
     it produce real output, such as a dry-run mode.

1. Plan first; change nothing yet.
   - List every job: cron functions (`crons` in vercel.json), GitHub Actions workflows that fetch or commit data,
     timers inside the app, scripts run by hand, and pages that fetch from slow sources when a visitor loads them.
   - For each: what it reads, what it writes (including emails or messages it sends), how often it runs, how
     long it runs, and what happens today when it fails. Read the host's logs for the last day of runs.
   - Say which ones Trigger.dev should run and which stay where they are. Trigger.dev runs jobs, not the website.
   - Read Trigger.dev's current pricing and say which plan the number of schedules needs, and what the plan's
     log retention and alert destinations mean for this project.
   - Stop and show me the plan.

2. Build the new version beside the old one, not instead of it. Work in a separate git worktree or branch.
   - Give the new pipeline its own copy of the data: a database branch, a copy, or a separate schema.
   - Make three logins: read-only on live; full access to the copy only; and, for the switchover later, one
     that can change rows on live but not the schema. Write tokens straight into a gitignored .env file with
     quoted values; never print them. Prove the read-only login gets "permission denied" with a real INSERT
     inside a transaction you roll back.
   - Every task names the login it expects and checks it before doing anything: it tries a write and a
     CREATE TABLE (rolled back or dropped again) and refuses to run if the result doesn't match its role, if
     its login is missing, or if the copy's address is the live one.
   - Jobs that send email or messages: the copy pipeline must never send. Force dry mode in code, not in env,
     and prefer a "list only" mode that skips model calls too.
   - Reuse the existing job code: call it from tasks. Run Python with @trigger.dev/python (python.runScript
     plus pythonExtension). List every file the Python needs in `scripts` (config folders too, not just .py).
   - Data files a job commits to git move into a database table, served by an API route that falls back to the
     old file. Keep the old addresses working if anything else reads them.
   - Find code that runs CREATE or ALTER on every run (including a CLI entry point). Make it skip the setup when
     every table, column and index already exists, by reading the schema, so a rows-only login can start.
     Add a test that denies DDL and proves the job still starts.
   - Keep the Trigger.dev files out of the website's build (for Vercel, .vercelignore), and say how you'll prove
     that on a preview build.

3. Prove it locally before Trigger.dev is involved.
   - One script runs the same steps as the tasks against the copy: check logins, refresh the copy from live,
     run the job, compare.
   - The compare shows counts per section and per source, rows on one side only, and how fresh each side is.
   - Confirm nothing was sent and nothing changed on live, by reading the databases. Show me the comparison.

4. Set up Trigger.dev.
   - I create the account and project. Run `npx trigger.dev whoami` first, then ask me for the project ref.
   - Declarative schedules go live the moment you deploy. Say when each will first fire, and time the copy's
     runs so they don't collide with the old job (or run one minute before it, to predict it).
   - Use syncEnvVars for at most one non-secret address. Keep the full deploy log and tell me which variables
     were synced, by name.
   - For every other value, give me a table: name, what to put in it, Secret or not, and the narrowest kind of
     token (read-only database token, read-scaling warehouse token). I create tokens myself in a terminal and
     add them in the dashboard. Never upload a token from the shell.
   - Deploy with `npx trigger.dev deploy`.

5. Test it.
   - The CLI can't start a run, so ask me to click Test on each task (Tasks in the sidebar, or the Test page link
     the deploy prints). Include one task that should be refused for having no login, to prove the guard.
   - Verify each run by reading what it wrote in the database, and use `npx trigger.dev runs list` and
     `runs get <id>` for statuses and errors. Never read the CLI's stored token to call the API yourself.

6. Switch over only when I say so.
   - The new pipeline writes live with the rows-only login. Prove it can change a row and can't CREATE or ALTER.
   - The old jobs keep running against a copy, with a login that can't write live.
   - The daily compare fails when live hasn't refreshed in 36 hours or drifts more than 5% from the old one.
   - Open a pull request and check the preview build; don't push to the main branch or merge unless I say so.
   - Write down how to undo the switch.

7. Alerts.
   - Alerts are under Observability in the dashboard sidebar, per environment: pick Production first.
   - Create a runs alert that fires on any failed run (threshold > 0). Check the threshold after creating it:
     an alert drafted by "Ask Trigger" defaulted to "> 50 failed runs over 10 minutes", which never fires for
     jobs that run a few times a day. Make sure it has a channel.
   - New projects can't create a failed-deploy alert (the legacy "Deployment failure" alert is "Coming soon"
     to the new system). Say so, and suggest a CI notification if deploys run from CI.

Throughout:
- Never print or commit secrets, database addresses, account or project IDs.
- Don't describe dashboard screens you haven't seen as fact. If I can't find something, ask for a screenshot,
  and look for a CLI command that does the same thing.
- At each stop, say what you verified and what you didn't.