Franz
Franzโ€ข3w ago

Web Cache API not available in Deno Binaries?

It seems like the Web Cache API isn't available in deno binaries created through deno compile. Is there any config that I need to change to enable this, or is this Web API just not available in Deno binaries? I see that the Web Storage API isn't available in Deno binaries, but I was wondering if the Web Cache API not working in Deno binaries is also intended. The specific error I'm seeing when I use try to use the the Web Cache API (in this case, caches.open("foo")) is TypeError: CacheStorage is not available in this context. I would appreciate any workarounds/solutions here, I need to be running my application through a binary generated through deno compile.
2 Replies
Mrcool ๐Ÿ‡ต๐Ÿ‡ธ
Yes it doesn't exist in the standalone mode, you'll need a workaround like the one for localstorage here https://jsr.io/@sigma/deno-compile-extra/doc/localStoragePolyfill/~/setupLocalStorage I added a polyfill here https://jsr.io/@sigma/deno-compile-extra/doc/cachesPolyfill maybe give it a try
Leokuma
Leokumaโ€ข7d ago
GitHub
deno_cache panics when using compile ยท Issue #18889 ยท denoland/...
General information The panic occurs when using the cache function of x/hono@v3.1.6/middleware.ts and only when using the compile command. When running directly, it seems to be working just fine. R...

Did you find this page helpful?