#Cloned data in preview deployments
4 messages · Page 1 of 1 (latest)
Hi @dusty sierra. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
Unfortunately, cloning production data directly into preview deployments is not currently supported in Convex. The documentation explicitly states:
"Viewing changes against a copy of production data or importing data from a different Convex deployment is not supported." [Preview Deployments]
What you can do instead
The supported approach for seeding data in preview deployments is to run a Convex function during deployment. You can set up your build command like this:
npx convex deploy --cmd 'npm run build' --preview-run 'init'
This runs your init function (e.g., the default export in convex/init.ts) on the fresh preview deployment, populating it with synthetic or representative seed data. [Seeding Preview Deployments]
You can also use npx convex import with a committed seed data ZIP file as part of your build script, for example:
npx convex deploy --cmd 'npm run build' && \
if [ "$VERCEL_ENV" == "preview" ]; then \
npx convex import --preview-name "$VERCEL_GIT_COMMIT_REF" seed_data.zip; \
fi
This ZIP file could be a previously exported snapshot (e.g., from a dev deployment), but it would need to be committed to your repo ahead of time — it's not a live clone of production. [Data Import]
Summary
| Approach | Supported? |
|---|---|
| Auto-clone from production to preview | ❌ Not supported |
Seed via a Convex function (--preview-run) |
✅ Supported |
| Import a pre-committed ZIP snapshot | ✅ Supported |