LocalStorage Override
I'm using a library (@supabase/supabase-js), and I'm compiling my Deno app into an executable, however when I run it I get:
error: Uncaught NotSupported: LocalStorage is not supported in this context.
The weird thing, is that I have a custom storage adapter for Supabase (using SQLite more or less) however I'm still getting this issue.
My question is, is it possible to override the localStorage
usage in a third-party library so I can use this executable?
Thanks!8 Replies
I haven't tested it, but a hacky way to do this is potentially overriding the prototype. Something like:
but for all of the methods
yeah tried that, same issue occurs
gotrue-js (the lib where the error occurs) apparently uses
globalThis.localStorage
a potentially better way of doing this is using an import map to point gotrue-js to a patched version
oh smart
could deno like be seeing the
localStorage
when parsing my code or something? really trying to figure out what's going on here lolnot sure what the details are, @crowlkats any ideas?
localstorage is persistent, and as such requires a place to write a file, and since that is not settable, that is the reason you cannot use it when compiled
sure, but in this case we are using a library that uses it and we want to prevent it from doing that
still looking for a solution here, any ideas?