Vitest `Failed to pop isolated storage stack frame` when error thrown

With a durable object as simple as:
export class FeedStorage extends DurableObject {
async test() { throw new Error("My impl is broken") }
}
export class FeedStorage extends DurableObject {
async test() { throw new Error("My impl is broken") }
}
And running tests through the vitest integration:
it('fetches feed', async () => {
const stub = env.FEED_STORAGE.get(env.FEED_STORAGE.idFromName('main'))
const res = await expect(() => stub.test()).rejects.toThrowError()
})
it('fetches feed', async () => {
const stub = env.FEED_STORAGE.get(env.FEED_STORAGE.idFromName('main'))
const res = await expect(() => stub.test()).rejects.toThrowError()
})
I end up with Vitest caught 1 unhandled error during the test run., and Failed to pop isolated storage stack frame I'd expect this to be propagated up through rpc as it is mentioned in the docs here so vitest can handle it. What is the suggested way to handle thrown errors in implementation in tests?
4 Replies
Burrito
Burrito2w ago
I also have the same issue and never gotten an answer. I ended up putting that RPC method behind a worker route and test the route instead. Not ideal.
Ben
Ben2w ago
lmao change the name of the function "test" I had this exact same problem @jman I think naming an RPC function "test" is not allowed lol
jman
jmanOP2w ago
No, the same behavior persists in the above example if the function name is changed to anything else. myCustomFunc for example. Created issue here: https://github.com/cloudflare/workers-sdk/issues/7707
Ben
Ben2w ago
ah sorry about that then

Did you find this page helpful?