Can't access function from Supabase custom library in Javascript Query

I added Supabase libraries to see if i could use the createClient function which would allow me to use the list() function from Supabase buckets in a Javascript Query but i get several error messages.


import { createClient } from "@supabase/supabase-js";

const supabase = createClient(SUPABASE_URL, TOKEN);

const { data, error } = await supabase

Error messages I received trying different things:

  • query4: Cannot use import statement outside a module

Libraries I added:

Hi @salsua, thanks for writing in! In terms of the immediate error message you're receiving, you may be able to get around that by leveraging the destructuring syntax rather than the import syntax (eg: const { createClient } = supabase). However, all Javascript runs in a sandbox in Retool, and therefore connecting directly via supabase is not possible from a Javascript query.

With that in mind, we recommend leveraging our first-class integration for Rest APIs by utilizing the Rest API provided by supabase. Would that be able to work for your use case?

Hi @grace, thanks for the clarification.

I'd like to use the supabase client for auth and storage because the REST API doesn't provide this functionality.

Is there any way to import and use the supabase library hosted at

Hey @mikek78, you can import certain libraries into Retool by following the steps in our docs here. However, as stated earlier in this post because of how Javascript is sandboxed connecting directly to Supabase won't be possible.

There are multiple auth configurations you can set up for your REST API. This doc here will help you set up custom auth for your REST API. Hope this helps!