There're several messages about `An RPC stub was not disposed properly`, but I still couldn't figure

There're several messages about An RPC stub was not disposed properly, but I still couldn't figure out the issue. I made a minimal reproducible example. My workflow has 1 step and does nothing except for logging:

export class AddOrUpdateItemWorkflow extends WorkflowEntrypoint<Bindings, Params> {
    async run(event: WorkflowEvent<Params>, step: WorkflowStep) {
        await step.do('assign item sqid', async () => {
            console.log(event.payload.item.title);
        });
    }
}


My worker calls it like so

const instance = await env.ADD_UPDATE_ITEM_WORKFLOW.create({params: { item }});
console.log(instance.id);
console.log(await instance.status());


When testing locally, in about 25% of cases I get:

[ERROR] An RPC stub was not disposed properly. You must call dispose() on all stubs in order to let the other side know that you are no longer using them. You cannot rely on the garbage collector for this because it may take arbitrarily long before actually collecting unreachable objects. As a shortcut, calling dispose() on the result of an RPC call disposes all stubs within it.


Is this a Miniflare issue or I'm missing something fundamental? The workflows seemingly finish correctly without errors.
Was this page helpful?