i have a project that's using durable

i have a project that's using durable objects in various workers environments, which was originally set up with the durable objects attached to their own worker. i recently tried to consolidate the durable objects to a single worker, and when i tried to set up my wrangler file to transfer the durable object storage to the new worker, the transfer seems to have failed. the durable objects don't have any data in the new worker. here's how i set up my DO migrations. did i do something wrong? i wasn't able to figure this out based on the documentation.
"durable_objects": {
"bindings": [
{
"name": "DO_1",
"class_name": "FirstDurableObjectClassV2"
},
{
"name": "DO_2",
"class_name": "SecondDurableObjectClassV2"
},
]
},
"migrations": [
{
"tag": "v1",
"new_sqlite_classes": [
"FirstDurableObject",
"SecondDurableObject",
],
},
{
"tag": "v2",
"transferred_classes": [
{
"from": "FirstDurableObjectClass",
"from_script": "old-script",
"to": "FirstDurableObjectClassV2"
},
{
"from": "SecondDurableObjectClass",
"from_script": "old-script",
"to": "SecondDurableObjectClassV2"
},
]
}
]
"durable_objects": {
"bindings": [
{
"name": "DO_1",
"class_name": "FirstDurableObjectClassV2"
},
{
"name": "DO_2",
"class_name": "SecondDurableObjectClassV2"
},
]
},
"migrations": [
{
"tag": "v1",
"new_sqlite_classes": [
"FirstDurableObject",
"SecondDurableObject",
],
},
{
"tag": "v2",
"transferred_classes": [
{
"from": "FirstDurableObjectClass",
"from_script": "old-script",
"to": "FirstDurableObjectClassV2"
},
{
"from": "SecondDurableObjectClass",
"from_script": "old-script",
"to": "SecondDurableObjectClassV2"
},
]
}
]
7 Replies
sheffield
sheffieldOP•2mo ago
any ideas/help here? i'm pretty stumped
Larry
Larry•2mo ago
Have you moved the code into this Worker code file and export them under those names? That's all I can think of right now.
sheffield
sheffieldOP•2mo ago
yep! first thing i checked 🙂
Unsmart
Unsmart•2mo ago
As per the documentation you must not run a creation migration. In order for it to be transferred the transfer migration must be the one that actually creates the binding. https://developers.cloudflare.com/durable-objects/reference/durable-objects-migrations/#transfer-migration
No description
sheffield
sheffieldOP•2mo ago
thanks! my understanding is that with this setup, the new_sqlite_classes creation migration shouldn't interfere because the durable object class names are different—is that not the case?
Larry
Larry•2mo ago
That's how I read that note also, but did you try removing the v1 migrations? If there is production data in there, make sure you have a backup.
sheffield
sheffieldOP•4w ago
i haven't tried that, but will give it a shot—thanks

Did you find this page helpful?