RPC dispose not available?

Hey folks, I'm calling an RPC worker locally from a Cloudflare Astro project, 11.0.4 on the CF Astro adapter, Wrangler 3.74.0 When I call an RPC method, I get this:
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.
However there is nothing on dispose or [Symbol.dispose] for me to call, both are undefined. Am I in version incompatibility hell?
1 Reply
Shravan
Shravan3mo ago
I had this in runtime, but not in type system. made a helper temporarily
export const disposeSerializableResult = <T, E extends WolfError>(serializable: SerializableOk<T> | SerializableErr<E>): void => {
if (typeof serializable === 'object' && serializable !== null) {
const disposableValue = serializable as unknown as { [Symbol.dispose]?: () => void };
if (typeof disposableValue[Symbol.dispose] === 'function') {
disposableValue[Symbol.dispose]?.();
}
}
};
export const disposeSerializableResult = <T, E extends WolfError>(serializable: SerializableOk<T> | SerializableErr<E>): void => {
if (typeof serializable === 'object' && serializable !== null) {
const disposableValue = serializable as unknown as { [Symbol.dispose]?: () => void };
if (typeof disposableValue[Symbol.dispose] === 'function') {
disposableValue[Symbol.dispose]?.();
}
}
};
Want results from more Discord servers?
Add your server