D
Deno

help

LocalStorage Override

AAmusedGrape8/5/2023
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!
IioB8/5/2023
I haven't tested it, but a hacky way to do this is potentially overriding the prototype. Something like:
// no-op
Storage.prototype.setItem = () => {}
// no-op
Storage.prototype.setItem = () => {}
but for all of the methods
AAmusedGrape8/6/2023
yeah tried that, same issue occurs gotrue-js (the lib where the error occurs) apparently uses globalThis.localStorage
IioB8/6/2023
a potentially better way of doing this is using an import map to point gotrue-js to a patched version
AAmusedGrape8/6/2023
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 lol
IioB8/6/2023
not sure what the details are, @crowlkats any ideas?
CcrowlKats8/6/2023
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
IioB8/6/2023
sure, but in this case we are using a library that uses it and we want to prevent it from doing that
AAmusedGrape8/6/2023
still looking for a solution here, any ideas?

Looking for more? Join the community!

Recommended Posts
Bad implementation of X25519?I can't generate a shared secret with the current implementation of X25519 ```ts const alice = awaiResize image/convert on uploadHi there, I want to store images uploaded in webp format at 200x200px. Has anyone done something likI cant import the Zustand module from deno.I leave a photo of what it shows when I put the url to the import map. And try to cache the module.Sub hosting SAAS appWhat technologies are behind the Deno Deploy feature, where you can set up your own domain name? I What should my entry point be on Deno Deploy?Only ever used firebase before. I'm getting a 502 bad gateway error when deploying my website.tsParticles & DenoHi, I’m working on a personal project with Deno & Lume. I’m trying to use tsParticles with preact. Looking for a library to pretty print </br>, <a>, etc tagsAs that title says, I'm looking for a library that can pretty print a string containing the mentioneImporting `puppeteer-cluster` from esm.sh causes `does not provide an export named 'default'` errorWhen importing `https://esm.sh/puppeteer-cluster@0.23.0` I get the following error: ``` error: UncauDeno linting not workingHello everyone, I enabled deno for a subpath in my project (`./supabase`) but unfortunately I'm not deno_pythonI'm trying to use Python with Deno with https://deno.land/x/python@0.2.7 What should I do to enable Deno VS Code plugin too aggressive in auto-completionI'm new to Deno and learning through some tutorials. I'm using VS Code and have the Deno plugin enabhow to exit all async command in deno task?consider this code ```json { "tasks": { "dev-server": "deno run --watch --allow-read --allow-nnode-pre-gyp install failing inside docker containerI'm building something that depends on a library with a native component (pulsar-client) and it doesSet a cookie in GET and retrieve in POSTbeen tryinig to do this for a couple hours now. Basically I want a way to return the user to the prWhat are newUserProps()I'm reading saaskit source, and I don't understand the point of `newUserProps()`. Why not just definRun a detached child process in DenoI'm looking at running a detached child process using Deno. Specifically I want run something like adeno info returns module not found``` deno info https://raw.githubusercontent.com/Murcul/norm/v1.3.0/src/mod.ts error: module could nocan't scrub video```<div className={"flex flex-col text-primary w-full lg:w-1/2 justify-center"}> <video classNamProper usage of `Deno.HttpClient`Hi! I'm creating an application which allows the internal use of HTTP proxies for certain tasks. In What's a good way to write tests for a script which does a bunch filesystem wrangling?As per the title - I have a script which, given a folder, does a bunch of moving and renaming. I'd l