lumeland / imagemagick-deno

Deno port of the WASM library for ImageMagick
https://deno.land/x/imagemagick_deno
42 stars 3 forks source link

CacheStorage is not available in Deno Deploy #6

Closed pixeleet closed 11 months ago

pixeleet commented 1 year ago

Was playing around with trying to get a next/image like component for deno/fresh. Needed to manually patch mod.ts to be able to get deploy working.

It seems to be that CacheStorage is not available in Deno Deploy.

reggi commented 1 year ago

Facing the same issue:

ReferenceError: caches is not defined
    at initialize (https://deno.land/x/imagemagick_deno@0.0.22/mod.ts:12:17)
    at file:///src/main.ts:6:7
oscarotero commented 1 year ago

I just released 0.0.24 that detects the availability of caches before using it. It should work on Deno Deploy now.

reggi commented 1 year ago

@oscarotero wow fast turn around thanks. I'm trying to wrap my head around how this should work. Yesterday I just caved and downloaded the wasm file and added it to my repo that way I don't have to worry about cold-start having to download the file in real-time. With your solution will instances be downloading this binary often?

oscarotero commented 1 year ago

@reggi As you can see, it only downloads the binary file if caches does not exist. This works both in deno-cli (in which cache will be used) and deno deploy (that won't be cached, but I guess it's not a big deal because the script only starts once).

I hope Deno Deploy implements CacheStorage soon (although I doubt it).