https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • CLI via NPM doesn't work
    l

    Ludvig

    09/06/2022, 5:41 PM
    Repost from https://github.com/supabase/cli/issues/441 https://github.com/supabase/cli/issues/127#issuecomment-1226884931 Let the powershell terminal speak for itself
    Copy code
    > npm i supabase
    changed 1 package, and audited 526 packages in 3s
    found 0 vulnerabilities
    
    > npx supabase -h
    'supabase' is not recognized as an internal or external command,
    operable program or batch file.
    I have tried doing it using the global flag too. I have my PATH environment variables set up correctly too, so that's not the issue.
    Copy code
    > npm i supabase -g     
    
    added 14 packages, and audited 15 packages in 4s
    found 0 vulnerabilities
    
    > npm list -g --depth 0
    C:\Users\Username\AppData\Roaming\npm
    └── supabase@1.4.2
    
    > supabase login
    supabase : The term 'supabase' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the 
    name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:1
    + supabase login
    + ~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (supabase:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException
    NPM version: 8.3.1 Node version: 17.4.0 Docker version: 20.10.17, build 100c701 OS: Windows 10 Pro (21H2 19044.1949) 64bit
    n
    • 2
    • 13
  • Policies Question
    j

    jdgamble555

    09/06/2022, 6:39 PM
    Do Postgres policies actually add a filter to the original query, or do they filter after the original query has return its results? This could be a huge difference for large databases, so I am trying to understand. Thanks, J
    g
    • 2
    • 5
  • migrating from email auth to phone auth
    c

    coleretriever

    09/06/2022, 10:40 PM
    I'm looking to switch an authentication system over to Twilio OTP's with Supabase, but its unclear if thats actually possible as a clean migration. Is there a best practice for doing this? Ideally I’d like users to be able to switch to phone sign in with an email backup.
    g
    c
    • 3
    • 3
  • How does supabase handle dev and prod environments?
    m

    merlo

    09/06/2022, 10:58 PM
    Should I duplicate a project? How do maintain two separate ones after wards?
    j
    h
    • 3
    • 2
  • Change PgBouncer Mode
    c

    capezolo

    09/06/2022, 11:08 PM
    Hello. I had a problem with another app related to PgBouncer's Transaction mode. Is there a way for me to change the pool mode to session?
    g
    • 2
    • 2
  • Order() not working, why?
    j

    joshcowan25

    09/06/2022, 11:42 PM
    I'm trying to order my query by ord from category. Ord is a number from 0 to 8 and I want all the zero to come first when I call the query. What did I do wrong?
    g
    • 2
    • 2
  • Storage - download files in 1 request
    j

    Julien

    09/06/2022, 11:52 PM
    I have a select request which gets information from a table. Among these information, I get the ``bucket_id`` and ``path`` of some files stored in the S3 storage. Is there a way to get the raw string file from within the select request or it's mandatory to perform a second request with the ``download()`` method of the storage object like so:
    Copy code
    ts
    supabase
      .storage
      .from(bucket_id)
      .download(path)
    Doing this in just 1 request would simplify the client side code and make the content appears all at once instead of having the text to appears and later on the images. According to this: https://supabase.com/docs/guides/database/extensions/plv8#create-plv8-functions I can use the JS extension and that will give me access to the supabase object inside database functions? I assume that by looking at the JavaScript example under the sentence: ``You can call plv8 functions like any other Postgres function:``. Is that true? If yes, I will be able to build a database function to select the info from the database & get the raw string from the S3 storage so that would be everything I need. Otherwise, I suppose that I can do a normal postgresql database function to perform the select and use the HTTP extension to get the raw string from the S3 storage, I just have to grab the get url from the download method (I found it in the node_modules), right?
    g
    • 2
    • 42
  • import json deno edge function
    s

    stefikira

    09/07/2022, 12:03 AM
    Did anyone encountered an issue when trying to import a json file in a TS file(edge function), it cannot seem to find the specific file. The path is correct though (double and triple checked it) and the IDE doesn't finds it either. I'm trying locally with docker, running
    supabase functions serve <functionName>
    • 1
    • 1
  • How to access auth schema using service key?
    j

    jxyz

    09/07/2022, 2:09 AM
    I wanna access the auth.users but I get the following: The schema must be one of the following: public, storage, graphql_public relation "public.users" does not exist
    g
    • 2
    • 4
  • What does this mean?? Tech stack - Supabase auth + Nextjs
    t

    try_catch.js

    09/07/2022, 3:26 AM
    I have no idea what does this mean...I'm using Google for auth on my nextjs app.
    y
    • 2
    • 1
  • Error remaining connection slots are reserved for non-replication superuser connections.
    r

    Raketa

    09/07/2022, 7:01 AM
    Hello community! Has anyone had such an error? In recent days, an error has been regularly occurring: "remaining connection slots are reserved for non-replication superuser connections". What can be done about this problem?
    g
    a
    • 3
    • 10
  • Using object storage with the Rest API
    l

    LazyLima

    09/07/2022, 8:10 AM
    In its current state, is it possible to use object storage with the Rest API?
    l
    • 2
    • 1
  • supabase functions serve Error unable to upgrade to tcp, received 409
    m

    martinffx

    09/07/2022, 9:10 AM
    I'm trying to test a function locally, I run the local stack
    supabase start
    Everything starts up nicely but I get the following when trying to serve my test function locally:
    Copy code
    $ supabase functions serve --debug email-confirmation      
    Error: unable to upgrade to tcp, received 409
  • Table Editor to SQL
    s

    Shibi

    09/07/2022, 9:48 AM
    How to get SQL query that can generate the exact table created using Table Editor?
    s
    • 2
    • 2
  • No such image Error
    c

    chaos

    09/07/2022, 11:14 AM
    Error: Error response from daemon: No such image: public.ecr.aws/t3w2s2c9/studio:v0.1.0 I am getting this error while running supabase start It has occurred first time
    h
    • 2
    • 2
  • Struggles auth-helpers-nextjs
    a

    Aaron Me

    09/07/2022, 11:51 AM
    Anywhere i can find some good docs / example projects? I am using Magic Link for the login but its supper bad, sometimes it works, sometimes it doesn't cookies are set but the user is not being recognised. When I enter the same cookies manually and refresh a few times it finally works but this is not very user-friendly. I am googlin up and down and only find people with the same problem.
    s
    • 2
    • 1
  • Initializing docker database
    m

    madsbuch

    09/07/2022, 12:48 PM
    We use supabase, and really want to use the database in our CI env! We already have exported the data from our dev environment to the
    preview_data.sql
    file and try to start the database with following docker-compose service entry:
    Copy code
    database:
        image: supabase/postgres:latest
        ports:
          - 5432:5432
        command: postgres -c config_file=/etc/postgresql/postgresql.conf 
        volumes:
          - ./data/preview_data.sql:/docker-entrypoint-initdb.d/preview_data.sql
        environment:
          POSTGRES_PASSWORD: postgres
    it fails:
    Copy code
    database_1  | [local] 2022-09-07 12:46:16.815 UTC [70] postgres@postgres ERROR:  role "supabase_admin" does not exist
    database_1  | [local] 2022-09-07 12:46:16.815 UTC [70] postgres@postgres STATEMENT:  ALTER SCHEMA auth OWNER TO supabase_admin;
    database_1  | psql:/docker-entrypoint-initdb.d/preview_data.sql:26: ERROR:  role "supabase_admin" does not exist
    preview-infrastructure_database_1 exited with code 3
    However, it seems like this role is being set up after files from the
    docker-entrypoint-initdb.d
    folder is being executed. When we use
    psql postgres://postgres:postgres@localhost -f ./data/preview_data.sql
    it works flawlessly! Anyone with suggestions to getting the file in
    docker-entrypoint-initdb.d
    to work?
    • 1
    • 1
  • Custom Supabase jwt returns invalid signature
    g

    glen

    09/07/2022, 1:13 PM
    Hi Creating and using Supabase jwt returns an invalid signature but I don't know why. (I have verified my keys) Create a Supabase access token signed with a Supabase secret
    Copy code
    export default async function handler(
      req: NextApiRequest,
      res: NextApiResponse
    ) {
      const payload = {
        userId: req.query.user,
        exp: Math.floor(Date.now() / 1000) + 60 * 60,
      };
    
      const token = jwt.sign(payload, supabaseKey);
    
      return res.status(200).json({ token });
    }
    Initialize a Supabase client with the access token
    Copy code
    export const getSupabase = (access_token: string) => {
      const supabase = createClient(supabaseUrl, supabaseAnonKey, {
        global: {
          headers: {
            Authorization: `Bearer ${access_token}`,
          },
        },
      });
    
      return supabase;
    };
    * Upload file to Supabase storage*
    Copy code
    async (file: File) => {
    
         // Get token from NextJs Api route
         const response = await fetch(
            `http://localhost:3002/api/supabase?user=${user}`
          );
         const { token } = await response.json();
    
         // Pass token to Supabase client 
         const supabase = getSupabase(token);
    
         const { data, error } = await supabase.storage
             .from(bucket)
             .upload(file.name, file);
         });
        },
    Returns
    Copy code
    {statusCode: '400', error: 'invalid signature', message: 'invalid signature'}
    ,
    g
    • 2
    • 4
  • Sort rows by date?
    d

    Deleted User

    09/07/2022, 2:22 PM
    Hello, I have rows with a column called created_at. The date format looks like this: 2022-09-07 How could I sort from most recent date at the top to latest date at the bottom?
    g
    • 2
    • 3
  • Send user temporary log in password
    d

    DevThoughts

    09/07/2022, 3:13 PM
    Is there a way with user invite to send temporary password, then next redirect user to create new password?
    s
    • 2
    • 1
  • Connect google calendar api with account
    k

    kresimirgalic

    09/07/2022, 3:54 PM
    Hey guys, i want to connect google calendar api, and fetch events to get all meetings i have during some period of time. Main problem i have right now is which access_token do i need to provide in gapi client? This is my current implementation on initialisation of gapi client where i pass session:
    Copy code
    const initClient = useCallback(async () => {
        if (window.gapiIsInitialized) return
    
        console.log('init gapi')
        return gapi.client.init(GAPI_CONFIG).then(
          () => {
            // const access_token =
            //   session.user.identities.find((acct) => acct.provider === 'google')
            //     ?.access_token ?? ''
    
            if (session?.access_token === '') return
    
            gapi.client.setToken({ access_token: session.access_token })
    
            window.gapiIsInitialized = true
            return
          },
          (e) => {
            window.gapiIsLoading = false
            console.info('error init gapi client', e.details)
          }
        )
      }, [])
    The problem i am getting right now is this one: message: "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project."
    e
    d
    • 3
    • 2
  • Create projects for users?
    d

    DemosthenesLocke

    09/07/2022, 5:58 PM
    Is there a way to create a project for a user. Say I have someone creating a website and I want them to own the project, is there a way to create and manage another accounts projects?
    g
    • 2
    • 5
  • Using Select, eq, and range in JS Client iterating over ALL items not filtered?
    k

    Kelaos

    09/07/2022, 6:15 PM
    We're trying to retrieve data from our DB via the supabase JS client, we're filtering out data via the
    eq
    and use
    range
    to paginate until we no longer receive data. However, this is giving us a LOT of duplicates. I've tried chaining range then eq and eq then range and both give us thousands of duplicates. Any ideas what would be causing this/how to do it better ❓ I took a look at the docs and I don't think we missed anything obvious. I'm suspicious that it has to do with how Postgres doing things but I can't remember the keywords to look for that Here's a snippet of the code we're using to retrieve map markers from our DB.
    Copy code
    let markerList: Array<any> = [];
          let cursor = SUPABASE_MAX_ROWS;
          let data;
          let index = 0;
    
    
          do {
            data = await supabase
              .from('markers')
              .select('markers')
              .eq('markers->>Cluster Label', cluster)
              .eq('version', version)
              .eq('status', algorithm)
              .range(index, cursor);
    
            index = cursor + 1;
            cursor += SUPABASE_MAX_ROWS;
            markerList = markerList.concat(data.data);
          } while (data.body?.length);
    g
    • 2
    • 5
  • Migrate gcs to supabase storage
    r

    Relisora

    09/07/2022, 7:06 PM
    Hello, I am trying to transfer around 50gb of data from gcs to supabase storage. To download it, I used the very convenient
    gsutil
    , but to put the folders now in my supabase bucket, I am stuck with the dashboard that times out after uploading a few files. This maybe because my upload speed is much worse than my download speed. Is there a way for me to reliably (preferably from CLI) upload those folders to supabase storage?
    t
    • 2
    • 2
  • User management template + role
    t

    tonyhart

    09/07/2022, 7:31 PM
    so I want to enable/disable user insert into table, use role in profile done but how to check that in RLS ???
    g
    • 2
    • 2
  • update_at timestamp?! How To?
    a

    alx90

    09/07/2022, 7:41 PM
    Hey guys, I have a column which have the type timestampz. I try to fill the field like:
    Copy code
    payload.updated_at = new Date()
    //OR
    payload.updated_at = new Date().toISOString()
    //both is not working
    Im getting the following error:
    Copy code
    {
      code: '22007',
      details: null,
      hint: null,
      message: 'invalid input syntax for type timestamp with time zone: "6. September 2022, 17:21"'
    }
    g
    • 2
    • 2
  • supabase.auth.api.createUser duplicate key value violates unique constraint users_pkey
    j

    jxyz

    09/07/2022, 9:13 PM
    I have a server-side code using the service key,
    Copy code
    js
    const email = 'alice@gmail.com';
    const password = 'test1234';
    const create_user_response = await supabase.auth.api.createUser({ email, password, email_confirm: true });
    I am getting the following error, I am clueless why this happens. Any ideas?
    Copy code
    {
      user: null,
      data: null,
      error: {
        message: 'duplicate key value violates unique constraint "users_pkey"',
        status: 500
      }
    }
    g
    • 2
    • 14
  • DELETE user_role RLS fails silently instead of returning RLS error to user
    j

    jxyz

    09/08/2022, 12:09 AM
    We encountered this days ago but we ignored it at the time because manual browser-side checks can still prevent the end-user from encountering this bug. Simply put our RLS on INSERT works as expected, but our same RLS on DELETE just fails silently. INSERT returns 403 Forbidden with the correct error message "new row violates row-level security policy for table user_roles". DELETE however returns 200 OK with empty response body. The pic attached show these two RLS policies, which kinda boggles us on why the result is inconsistent.
    g
    • 2
    • 2
  • Can't see how to send a body with Database Webhooks
    d

    DanMossa

    09/08/2022, 12:38 AM
    Hello! I want to create a database hook so that everytime a row is inserted into a specific table, a url is hit with a body. I only see sections for Request, Headers, and Params. Should I be using something else to do this?
    g
    • 2
    • 1
  • Authenticated Presence
    b

    BiscuitCoin

    09/08/2022, 1:02 AM
    I'm trying to have a who's online list, but it seems that the presence api just allows me to send whatever via
    .track()
    . This could be easy to change your name or id to something fake and be abusive if it isn't tied to an authenticated user. Is there a method of getting the user id of the users present that isn't spoof-able?
    i
    j
    u
    • 4
    • 3
1...171819...230Latest