Build log · December 4, 2026
buildweek.ai on Trigger.dev
The second migration, and a test of the prompt the first one produced. I moved the daily jobs behind buildweek.ai from a GitHub Action that committed JSON files to Trigger.dev tasks that write Postgres. Every prompt I typed is quoted as typed, typos included. The pitfalls are written as product feedback for the Trigger.dev team, and the prompt at the end has this run's lessons folded in.
Colin Lowenberg
Agent: Claude Code (Fable 5.2)
Trigger.dev SDK 4.9.1
December 3–4, 2026
buildweek.ai: San Francisco Build Week: a daily newspaper-style front page of every hackathon, demo night and free lunch in the city, found each morning by an events agent.
For the Trigger.dev team
- Let the CLI start a run. It was the one step of the migration an agent couldn't do.
- Document the Python extension. The image's Python version had to be read from the Containerfile, and
runScript passes the whole task environment, database address included, to Python.
- Close the gaps that fail quietly. No failed-deploy alert for new projects, and
syncEnvVars's record form is never secret.
All feedback from this project · Feedback across all five projects
buildweek.ai is a static page on Vercel. Its data (Bay Area builder events, plus bounties, jobs and startup programs pulled from colinslist.org) was refreshed once a day by a GitHub Actions workflow that ran Python scripts and committed JSON files to main. Every commit redeployed the site.
That worked, and it hid a bug for two weeks. This post is how we moved it to Trigger.dev (v4 SDK) without taking the site down, what got better, and everything that went wrong on the way.
Before and after
|
Before |
After |
| Where the daily job runs |
GitHub Actions on a Tenki runner |
Trigger.dev, three scheduled tasks |
| Where the data lives |
JSON files committed to git |
Postgres (Neon), served at the same addresses |
| A deploy per refresh |
Yes, one site deploy a day |
No |
| Who can write the live data |
Anything with push access to main |
One database login that can change rows but not drop or alter tables |
| A second opinion |
None |
The old workflow still runs daily into a shadow copy, and a compare task checks one against the other |
| A failing step |
Logged and skipped; the workflow stayed green |
A failed run, which an alert can cover |
| Stale data |
Nobody would know |
The compare fails after 36 hours without a refresh |
| Cost |
Runner minutes |
About $0.50 a month of Trigger.dev usage, inside the Free plan's $5 |
One number that says why this was worth doing: the last 23 workflow runs were all green, and in at least the last one, one of the four event sources had crashed.
Step 1: Plan first, change nothing
Prompt: the colinslist prompt, reworded for this project.
Show the prompt as pasted
Migrate the buildweek.ai 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.
What came back. An inventory of eight things that could be called a job:
- One real daily job: the "daily agent" workflow. It reads eventhunt.ai, Luma calendars, aicollective.com, Tavily search and AIsa (X search and a model), and wrote
events.json, social.json and agent.json. It took 3.5 to 8 minutes.
- Two small refreshes in the same workflow: GitHub repo stats (which nothing on the page read any more) and the colinslist slices.
- Three Vercel functions that answer visitors (
/api/news, /api/tickers, /api/fog), each cached at the edge, plus weather fetched in the browser.
- A handful of map-rendering scripts run by hand.
The decision. Move the daily agent and the colinslist refresh. Leave the visitor-time functions on Vercel: they are fast and cached, and Trigger.dev runs jobs, not the website. Don't port the repo refresh at all.
The plan. Free is enough: 10 schedules allowed, 3 needed.
Prompt (sent while the plan was still being written):
trigger proj ref proj_… (the real ref, left out here)
Prompt (after reading the plan, answering "where should the new tables live?"):
Approve, existing Neon
Step 2: Build it beside the old one
Nothing on main changed during this step. The work went on a branch.
- Two schemas in the Neon database:
buildweek (to become live) and buildweek_shadow (the new pipeline's own copy). Two tables in each: files (one row per data file) and rows (one row per event, bounty, job or program).
- Fenced logins, created by a one-off owner script that writes the addresses to
.env.local and never prints them.
- Proof with real queries. As the shadow login: reading live is allowed; inserting into or deleting from live gives
permission denied for table; altering or dropping its own tables gives must be owner of table rows; reading the other project's tables in the same database gives permission denied.
- The login check. Every run does
SELECT current_user first and stops if it isn't the login the code names.
- The existing Python, reused. The scripts got one change: they read their data folder from
BUILDWEEK_DATA_DIR and default to the old folder. A task writes the current data into a scratch folder, runs the unchanged script on it with python.runScript, then loads what the script wrote into the tables in one transaction.
- No CREATE or ALTER in any run. Tasks only check that the tables exist.
- An API route that serves a file from the database and falls back to the committed copy.
The Trigger.dev side is small. The config:
export default defineConfig({
project: "proj_…",
dirs: ["./trigger"],
maxDuration: 1800,
build: {
extensions: [
pythonExtension({
scripts: ["./scripts/daily_agent.py", "./scripts/fetch_*.py", "./scripts/paths.py"],
requirements: ["tzdata"],
}),
syncEnvVars(async () => {
const value = process.env[DATABASE];
if (!value) throw new Error(`${DATABASE} is not set`);
return [{ name: DATABASE, value, isSecret: true }];
}),
],
},
});
And a task:
export const dailyAgent = schedules.task({
id: "daily-agent",
cron: "50 13 * * *",
queue: { concurrencyLimit: 1 },
run: async () => {
const target = await connect(LOGIN); // refuses any other login
try { return await runJob("daily-agent", target, runPython); }
finally { await target.db.end(); }
},
});
Step 3: Prove it locally
A local script runs the same steps as the tasks, starting Python with a child process instead of python.runScript, then compares the shadow copy with what the live site serves.
| File |
Section |
Old (live site) |
New (shadow) |
Only in old |
Only in new |
| events |
events |
129 |
131 |
0 |
2 |
| colinslist |
programs |
10 |
10 |
0 |
0 |
| colinslist |
bounties |
10 |
10 |
0 |
0 |
| colinslist |
jobs |
10 |
10 |
3 |
3 |
The local run also turned up the bug described under "Pitfalls" below.
Step 4: Deploy
npx trigger.dev whoami showed the CLI was already logged in. npx trigger.dev deploy --dry-run built the bundle without deploying, which let us read the generated Containerfile. Then npx trigger.dev deploy.
By hand, in the dashboard: Environment Variables → Add new → TAVILY_API_KEY and AISA_API_KEY, Production only, "Secret value" on.
Step 5: Test
Three clicks on the Test page, one per task.
Prompt:
they've run
Verification came from the database, not the run status: all four files refreshed at 07:04 UTC, and the stored run report showed paths inside Trigger.dev's container (/app/scripts, /tmp), 13 Tavily searches and 5 AIsa searches with results, 89 event links found and 1 event added.
Prompt (asked "switch now, or shadow for a few days?"):
Shadow for 3 days
Prompt (running the suggested check command; it failed, see pitfalls):
set -a; . ./.env.local; set +a; node pipeline/verify.mjs
Prompt (the corrected command):
cd /path/to/agent-city-sf-trigger && set -a && . ./.env.local && set +a && node pipeline/verify.mjs
Prompt:
is everything setup now?
The honest answer was "no": the shadow pipeline was running, but the switch, the alerts and a bug fix were all still open.
Step 6: Switch over
Prompt:
just get it done already
Prompt (mid-switch):
also are you supposed to be working on colin-ai or buildweek.ai?
What the switch did:
- Created the live writer login. Real queries: it can read and write live rows;
ALTER, DROP, TRUNCATE and CREATE are refused.
- Seeded the live copy from the verified shadow copy.
- Pointed the Trigger.dev tasks at the live login and redeployed.
- Made
/events.json, /colinslist.json, /agent.json and /social.json rewrites to the API route. The page did not change, and neither did colinslist.org, which reads buildweek.ai/events.json.
- Rewrote the GitHub workflow to run the same code into the shadow copy and commit nothing.
- Changed the compare to live against shadow, both in the database, failing on a 36-hour-old live copy, 5% drift, or a stale shadow copy.
- Checked all of it on a Vercel preview deployment, then opened a pull request.
Prompt:
Merge it
After the merge, all four live addresses answered 200 with x-data-source: database, 132 events.
How to undo it. Quick: set one Vercel variable (BUILDWEEK_DATA_FROM=file) and redeploy; the site serves the last committed copies. Full: revert the merge commit, which restores the files and the committing workflow, then set the task login back to the shadow one and redeploy.
Step 7: Alerts
Dashboard → Alerts (Production) → ⋮ → Channels → Add channel. Then New alert → Runs → "Any run failing". Because the compare task fails on stale or drifting data, that one alert covers a crash, a stall and a divergence.
Pitfalls, confusion, errors and mistakes
Feedback for Trigger.dev
- The CLI can't start a run. Every test needed a human to click in the dashboard. For an agent-driven migration this is the one step that can't be automated, and it is where the work stopped and waited.
- The docs don't say which Python the deployed image has. We found it by reading the Containerfile from
deploy --dry-run: Debian bookworm, so Python 3.11. Our workflow used 3.12 and the laptop had 3.9. It worked, but we only knew after deploying. One line in the pythonExtension docs would do.
python.runScript passes the whole task environment to Python. The env option adds to process.env; it doesn't replace it. So the database address synced for the Node task is also in the Python process, which doesn't need it. We blanked it by passing an empty value. An option to pass only named variables would be safer by default.
- No alert for failed deploys, as far as the docs say. "Deployment failure" is listed only as a legacy alert with "Coming soon" for its replacement. The prompt asked for alerts on failed runs and failed deploys; only the first has a clear answer.
- Does a declarative schedule count against the plan's schedule limit? The limits page gives the numbers (10 / 100 / 1,000+) but doesn't say. We assumed yes.
syncEnvVars has two return shapes with different secrecy. The record form { KEY: value } always creates non-secret variables; only the array form takes isSecret: true. Easy to sync a database address as a plain variable without noticing.
requirementsFile and requirements can't be combined, and requirementsFile is "only available in production mode". We used the inline list to avoid shipping Pillow, which only the site's image function needs.
- Build noise. Every deploy ends with three
UndefinedVar Docker warnings ($SSL_CERT_FILE, $REQUESTS_CA_BUNDLE, $PIP_CERT) from the generated Containerfile. They aren't ours to fix and they look like a problem.
- Free plan: one alert destination and one day of logs. Fine for this, but one day of logs means a failure on Saturday may be gone by Monday.
- What worked well:
deploy --dry-run; the deploy printing a direct link to the Test page; "Secret value" being on by default in the dashboard; schedules.task being about ten lines; the scripts running unchanged.
Things the prompt didn't fit
- The site had no database. The prompt talks about "the live data" and a login that can't write to it. Here the live data was JSON files in git. We had to introduce the database first, so the read-only proof in step 2 ran against an empty live schema, and the real test of the live login came at step 6.
- Two pipelines, one rate limit. eventhunt.ai limits requests per hour. Running old and new at the same minute would have starved one of them, so the new one runs 90 minutes later.
- Someone else reads the data files. colinslist.org fetches
buildweek.ai/events.json. Moving the page to a new API address would have left that feed frozen. Rewrites kept the old addresses working.
- A model in the pipeline makes "5% drift" fuzzy. Events are found partly by an LLM, so two honest runs differ. We measure drift on counts per section, not on exact rows.
Bugs found
- The eventhunt refresh had been crashing every day.
KeyError: 'time' in a sort, when an event had no time. The agent logged it and carried on, the step exited zero, and the workflow stayed green. It last worked on November 21. Found only because the local run printed the log where someone was looking.
Mistakes made during the migration
- A command that depended on the folder. The check command was given without a
cd, was run from the parent folder, and failed with Cannot find module. It also sourced a different project's .env.local on the way. Commands meant to be pasted should start with an absolute cd.
- The local proof didn't cover discovery. The laptop's Tavily key was rejected (13 ×
401 Unauthorized) and there was no AIsa key, so the local run exercised the known sources only. The first real test of search was the dashboard run.
- A security review found three real issues in the new code, all fixed before the merge:
- The API route built its fallback address from the request's
Host header: a path to fetching from an attacker's host and caching the result. It now reads the fallback from the deployment's own files.
- A stale shadow copy made the compare pass. A monitoring check that passes when its baseline is dead is failing open. It now fails.
- The setup script seeded the live copy automatically whenever it was empty. It now needs an explicit flag.
- Branch switched in a shared folder. The work started by switching the main checkout to a new branch, in a folder other sessions also use. Moving it to a separate git worktree hit a stash conflict on
.gitignore. Start in a worktree.
vercel link rewrote .env.local. It appended its own token to the file holding the database addresses. Nothing was lost, but nothing asked either.
- A push to
main and a secret upload were blocked. The permission system refused both in one command. The merge went through a pull request instead, which was the better route anyway. The workflow's database secret had to be handed to Colin as a command to run.
- Small ones: a SQL string mangled by shell quoting inside
node -e; one TypeScript error from an untyped JS import; a harmless sslmode warning from the pg library on every connection.
Confusion
- "is everything setup now?" The prompt's staged stops are good for safety and bad for knowing where you are. After the test runs passed, it looked finished. It wasn't: the site was still on the old pipeline. Each stop should end with a done / not done / waiting-on-you table.
- "colin-ai or buildweek.ai?" Several sessions, several repos, one shared database with another project's migration schemas already in it. A line naming the repo and branch at each stop would have answered this before it was asked.
- "just get it done already" came one message after "Shadow for 3 days". The cautious default was right on paper and too slow in practice. The prompt should ask up front whether to shadow first or go straight through.
Still open at the time of writing
- The GitHub workflow's database secret has not been added, so the shadow workflow will fail until it is.
- No run has happened yet as the live login; the first is the next schedule.
- The alert is Colin's to create.
- The file fallback on Vercel has been tested locally but not exercised in production, because the database has always answered.
A prompt you can reuse
This is the original prompt with the lessons above folded in. Replace the bracketed parts.
Migrate [PROJECT]'s background and scheduled jobs to Trigger.dev (v4 SDK), without risking the live site.
Work in order and stop where a step says to. Start each reply at a stop with: the repo and branch you
are working in, then a table of what is done, what is not done, and what is waiting on me.
Before you start, ask me one question: after the tests pass, should the new pipeline run in shadow for
a few days, or switch over straight away?
1. Plan first; change nothing yet.
- List every job: cron functions (e.g. `crons` or `schedules` in vercel.json), CI workflows that fetch
or commit data, scripts run by hand, and pages that fetch from slow sources on a visit.
- For each: what it reads, what it writes, how often, how long, and what happens today when it fails.
Read the last few runs' own logs, not just their status: look for steps that failed and were skipped.
- List everything that READS the job's output, including other sites and feeds, so no address breaks.
- Note any rate-limited source: old and new pipelines must not hit it in the same hour.
- Say where the data lives today. If it is files in git and there is no database, say so and propose
where the tables will live; ask me before using a database another project shares.
- Say which jobs Trigger.dev should run and which stay put. Trigger.dev runs jobs, not the website.
- Check Trigger.dev's current docs and pricing; say which plan the schedules need. Find the deployed
image's Python version (run `npx trigger.dev deploy --dry-run` and read the Containerfile if the
docs don't say) and compare it with the version the jobs use today.
- Stop and show me the plan.
2. Build the new version beside the old one, in a separate git worktree and branch. Never switch the
branch of the main checkout.
- Give the new pipeline its own copy of the data: a separate schema or database branch.
- Create a login that can read the live data but gets "permission denied" writing it. Prove it with
real queries, including that it cannot read any other project's tables in the same database.
- Every task checks `current_user` first and refuses to run as any other login.
- Reuse the existing job code; call it from tasks. For Python use `@trigger.dev/python`
(`python.runScript` + `pythonExtension`). `runScript` passes the whole task environment to Python:
blank the database address in its `env` so the script doesn't get it.
- Data files a job commits to git move into tables. Serve them at their OLD addresses (rewrites to an
API route) so no reader changes. The route falls back to the last committed copy, read from the
deployment's own files. Never build a URL from a request header.
- No CREATE or ALTER in any run. Setup is a one-off owner script; tasks only check the tables exist.
- Anything that copies data into the live tables needs an explicit flag.
3. Prove it locally before Trigger.dev is involved.
- Write a script that runs the same steps as the tasks, against the new copy.
- First check that every API key the jobs need works on this machine. If one doesn't, say which
steps the local run could not cover.
- Add a compare step: counts per section and per source, rows on one side only, and how fresh each
file is. If a model or search picks the rows, measure drift on counts, not exact rows.
- Show me the comparison.
4. Set up Trigger.dev.
- I create the account and project. Run `npx trigger.dev whoami`, then ask me for the project ref.
- Use `syncEnvVars` for the one database address the tasks need, in the array form with
`isSecret: true` (the record form is never secret).
- For API tokens, tell me to add each in the dashboard by hand, as a Secret, Production only.
Never upload a token from the shell.
- Offset the new schedules from the old ones if they share a rate-limited source.
- 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 and tell me exactly where.
- Verify each run by reading what it wrote in the database, and look for evidence it ran on
Trigger.dev and not locally. 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 I say so (or straight away, if that was my answer at the start).
- The new pipeline writes the live data with a login that can change rows but cannot drop, alter or
truncate. Prove it with real queries.
- The old jobs keep running against a copy, with the login that can't write live, and commit nothing.
- The compare runs daily and FAILS when the live copy is over 36 hours old, drifts more than 5%, or
the old copy it compares against is itself stale.
- Check everything on a preview deployment first. Then open a pull request; don't push to the main
branch. Tell me any secret the old pipeline's CI needs and give me the exact command to add it.
- Write down how to undo the switch, both the quick way and the full way.
7. Alerts. Walk me through creating a "any run failing" alert in the dashboard for Production, and tell
me whether a failed-deploy alert exists today.
Throughout:
- Never print or commit secrets or database addresses. Quote values in .env files.
- Every command you give me to paste starts with `cd` to an absolute path.
- Tools that link a project (e.g. `vercel link`) may rewrite .env files: check the file afterwards.
- At each stop, say what you verified and what you didn't.