Hello! 👋 We're running into these

Hello! 👋 We're running into these errors quite a lot.
================================================================================
Failed to pop isolated storage stack frame in test/room/websockets.test.ts's test "sent ops are received over WebSocket by connected clients on V7".
This usually means your Worker tried to access storage outside of a test.
In particular, we were unable to pop Durable Objects storage.
Ensure you `await` all `Promise`s that read or write to these services.

- AssertionError [ERR_ASSERTION]: Expected .sqlite, got /var/folders/ph/xtwbrg097hsby7l_v3yzqksh0000gn/T/miniflare-8aaec0213628bbac2ba6d110f6fce865/do/vitest-pool-workers-runner--__VITEST_POOL_WORKERS_USER_OBJECTRoom/1085f9c32aa7663554f69f6c3f0813434092fa3508aeaf220862b2e0d23efe56.sqlite-shm
================================================================================
================================================================================
Failed to pop isolated storage stack frame in test/room/websockets.test.ts's test "sent ops are received over WebSocket by connected clients on V7".
This usually means your Worker tried to access storage outside of a test.
In particular, we were unable to pop Durable Objects storage.
Ensure you `await` all `Promise`s that read or write to these services.

- AssertionError [ERR_ASSERTION]: Expected .sqlite, got /var/folders/ph/xtwbrg097hsby7l_v3yzqksh0000gn/T/miniflare-8aaec0213628bbac2ba6d110f6fce865/do/vitest-pool-workers-runner--__VITEST_POOL_WORKERS_USER_OBJECTRoom/1085f9c32aa7663554f69f6c3f0813434092fa3508aeaf220862b2e0d23efe56.sqlite-shm
================================================================================
I'm sure we're missing an await somewhere, but our test suite is pretty big, and it's like looking for a needle in a haystack. Any tips on narrowing down which test might be the culprit? We haven't been able to bisect our big test suite, because the error doesn't happen consistently. Any tips would be more than welcome. Would it be possible to add a bit more data/context to the error?
2 Replies
Vincent
VincentOP•8mo ago
After another day of debugging, it looks like I found the issue. It was caused by a test doing something seemingly harmless like:
const res = await fetch("/whatever"); expect(res.status).toEqual(200);
const res = await fetch("/whatever"); expect(res.status).toEqual(200);
But without "consuming" the request body: the key missing piece here was await res.text(). Adding that to the test made this error disappear. This was incredibly hard to find. Maybe you could update the error message with a hint that this could also be a possible source of this error?
Advany
Advany•6mo ago
Thanks so much for this!!!!! Someone really needs to fix this! The error is so strange...
Want results from more Discord servers?
Add your server