Dan Mercer
Dan Mercer2y ago

Support for `convex import` from a snapshot export?

When I try to use convex import to restore a table snapshot I just downloaded, I get this error:
500 Internal Server Error: InternalServerError: Your request couldn't be completed. Try again later.
500 Internal Server Error: InternalServerError: Your request couldn't be completed. Try again later.
Adding --append doesn't help. I'm using Convex 0.12.2
7 Replies
lee
lee2y ago
Hi! Sorry about the error, we see it on our side and will fix it soon. The issue is your data includes _id and _creationTime fields which cannot be imported. As a workaround, you could process the data (with python or node) to remove those fields.
Dan Mercer
Dan MercerOP2y ago
Oof but that makes sense. Is there a different way to backup and restore data from the DB?
ian
ian2y ago
There isn't a turnkey backup and restore at the moment. A backups feature has been discussed but not started. We're working on some improvements that will make it possible to do correctly, though. There is one thing I've been toying with the idea of, which I'd be interested in your feedback on: A script that turns a snapshot export (dir of JSON files) into a seed script, so you can take a deployment's data and make code to bootstrap a new dev deployment, in CI, etc. It would do inserts in batches, and may need to write documents with old ID references and patch them later with the new IDs, so this would mean the data would be inconsistent until the seeding is done. This is fine for a new dev deployment, but is risky for a prod deployment where you'd want transactional guarantees. (which is ultimately why we don't offer the snapshot import by default) I'd publish this code in a repo for folks to use / vendor in. Then you can adjust it if you want different behavior
Gorka Cesium
Gorka Cesium11mo ago
@ian is is possible to export a snapshot from dev and import it into prod?
lee
lee11mo ago
@Gorka Cesium that is possible now, yes (this is a very old thread)
Gorka Cesium
Gorka Cesium11mo ago
cool, that will save me time with the migration to prod

Did you find this page helpful?