How do I download my Durable Object data?

The UI just says this:

So, just to confirm, durable objects can store data but there is no method to snapshot, backup or download the data?

What are the best practises for schema migrations? E.g. if the JSON types change from one release to the next?

Thanks.

Is this possible, if not, any ETA for this feature?

There is no public ETA for that feature.

In the meantime, you can iterate over each instance using Durable Objects · Cloudflare Workers docs and export the data in whatever way makes the most sense for your application.

1 Like

But the REST API listing only contains the hex ID’s (not the human readable names), and there is no interface to extract the data from all durable objects in an account, right?

So this would mean you need to code a general solution to:

    1. Keep a global index of the durable object names (as the API does not do this).
    1. Create an fetch API to extract each durable objects storage

Is this right - I just want to check that I am not missing an easier way to do this. Thanks.

If you’re iterating over every object, you don’t need a global index of names - hex ID is sufficient to obtain a stub and send a request to the DO. We intentionally do not store the names passed to idFromName.

Yes, you’ll need to modify the fetch handler for the DO to respond to an appropriate request, whether that’s by returning the data or writing the data to another system using outbound fetch requests.

1 Like

Why do you intentionally not store the names?

The names are useful, especially for external systems - they are like primary keys.

Replacing the names with a hash hex ID means the “joins” with external systems no longer work as they do not know what idFromName uses for the hash function (they cannot associate a hex ID with the original name).

Not storing the names forces every Durable Objects user to keep an index of all names used themselves.

As an example I want to store all durable objects state in a single database, keyed by their durable object name.

It seems like name should be available from the Cloudflare API’s. Or at least a durable object should know it’s own name.

If you want a given DO to know its name, store it in the DO.

Not every user needs reverse lookup, and there is no length limit on names. Storing arbitrarily sized names by default would mean everyone was paying the cost of increased request and storage size.

It’s more likely that we’ll address that inconvenience with an optional tagging system.

1 Like