https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Where can i find the urls for the storage api?
    o

    Olyno

    08/17/2022, 6:54 AM
    Hi @tim_fully , please don't delete your message when solved, simply say what you found, it will avoid empty posts
    t
    g
    • 3
    • 6
  • Get authenticated user_id from twitter id
    s

    sbr

    08/17/2022, 6:50 AM
    Hi, What's the best way to query the auth tables to get the user_id given their twitter_id? Users can sign up via a magic link email and/or Twitter. To get the twitter id given the user_id I can run
    select raw_user_meta_data::json->'sub' from auth.users where id=[user_id]
    but how can I do the opposite? Thanks!
    s
    g
    • 3
    • 4
  • Auth0 with Supabase JWT expire
    a

    Alan Coppin

    08/17/2022, 7:15 AM
    Hey, I followed the tutorial on https://supabase.com/docs/guides/integrations/auth0#step-7-sign-auth0-token-for-supabase to hook Supabase with Auth0. I constantly have my JWT that expires after being connected a little bit, Has anyone got the issue as well? I can see discussion about it https://github.com/supabase/supabase/discussions/889 but doesn't seem to be solved
  • Cannot use the `.from().update().select()` chaining in v2 anymore?
    p

    peterkimzz

    08/17/2022, 7:50 AM
    When I upgrade v1 to v2, I got the errors. Is it right? The below code worked in v1
    c
    s
    s
    • 4
    • 5
  • I cant login to the UI on Chrome
    o

    omar

    08/17/2022, 9:37 AM
    Is there an issue with it? Here's a screenshot of the errors
    s
    • 2
    • 6
  • Error while using Supabase CLI
    r

    rison

    08/17/2022, 10:50 AM
    I ran
    supabase db remote commit
    on my terminal after linking to a new project. This created the migration file. But after that, any time I run
    supabase start
    or
    supabase db remote commit
    , I get the following error.
    Error: Error starting shadow database: ERROR:  relation "pgsodium.key_key_id_seq" does not existError: Error starting shadow database: ERROR:  relation "pgsodium.key_key_id_seq" does not exist
    I'm not sure what's going wrong. Please help.
    g
    • 2
    • 2
  • query get element by ID
    m

    maysa

    08/17/2022, 11:11 AM
    Hi everyone I'm using GraphQL API and wanted to make a query to get an element by ID . Unfortunately the result is the whole list. The query is in the screenshot below .
  • Add new Typescript to auth helpers
    c

    cdedreuille

    08/17/2022, 1:03 PM
    The new typescript generation is nice but how can we had it if we are using the NextJs Auth Helper?
    s
    • 2
    • 1
  • how to flatten returned data from joined tables?
    l

    Lukas V

    08/17/2022, 1:10 PM
    I have a recipes table and instructions table where I store JSON instructions, at the moment I join these tables like this:
    Copy code
    let { data, error, count } = await supabase
        .from('recipes')
        .select(
          `*,
        instructions(instructions)
        `,
          { count: 'exact' }
        )
        .eq('id', id);
    But I get the data this way:
    Copy code
    ingredients: (2) [{…}, {…}]
    instructions: {instructions: '{"root":{"children":[{"children":[{"detail":0,"for…format":"","indent":0,"type":"root","version":1}}'}
    How can I flatten my returned data, so that I don't have to call
    instructions.instructions
    ?
    s
    • 2
    • 1
  • Python Storage
    m

    Mihai Andrei

    08/17/2022, 1:40 PM
    Hello! I'm trying to upload a file though supabase-py. I take the file via an api route, and i try to do:
    Copy code
    response = supabase.storage().from_("images").upload(filename, file)
    But it seems the "file" should be a path? So i would need to store the file on my server, upload it to supabase and delete it later?
    s
    • 2
    • 1
  • Upsert not working because of error Column id is an identity column defined as GENERATED ALWAYS.
    t

    tinus

    08/17/2022, 1:46 PM
    I'm trying to do an upsert on a post, this is returning this error:
    Copy code
    code: "428C9"
    details: "Column \"id\" is an identity column defined as GENERATED ALWAYS."
    hint: "Use OVERRIDING SYSTEM VALUE to override."
    message: "cannot insert a non-DEFAULT value into column \"id\""
    Is there a setting I need to adjust for making this work? I'm using supabase-js to do the upsert.
    Copy code
    const { data, error } = await supabase
          .from("posts")
          .upsert({ ...form, price: Number(form.price) * 100 }) // price in cents
          .single();
    g
    c
    • 3
    • 4
  • Storage Upload Policies
    t

    Twisted Chaz

    08/17/2022, 2:17 PM
    I've got a public bucket called "albums" and I'm trying to allow authenticated users to insert and update objects into the bucket, but I keep receiving this error message
    new row violates row-level security policy for table \"objects\"
    . Can someone guide me in the right direction of how to setup these policies correctly. My Policies are as follows albums * None Other policies under storage.objects * Enable insert for authenticated users only * Enable update for authenticated users only Policies under storage.buckets * None
    g
    • 2
    • 7
  • How to get session on API route in Next.js
    m

    Mathiassio

    08/17/2022, 2:30 PM
    I'm trying to get the session to make a guard statement and to get the id of the user for then to pass the id into another function handling my call. But when I console.log(session) I get null back. If I do exactly the same in a page component it works fine and it provide me with the necessary object. This is what I have tried to do at /api/get/getRole.tsx:
    Copy code
    js
    import { supabase } from "@/utils/supabaseClient";
    import { getRole } from "@/utils/supabaseData";
    
    export default async (req: any, res: any) => {
      const session = supabase.auth.session();
    
      console.log(session);
    
      const userId = session?.user?.id;
    
      try {
        const data = await getRole(userId);
        return res.status(200).json(data);
      } catch (err) {
        console.error(err);
        res.status(500).json({ msg: "Something went wrong." });
      }
      res.end();
    };
    How can I get the session and the data into my API file?
    n
    • 2
    • 34
  • Get User by Phone Number or Email (supabase.auth.api)
    s

    sb

    08/17/2022, 2:57 PM
    Hi all! Does anyone know how I can get a user entity with phone number or email, rather than with id or jwt token?
  • authenticate user from js client, pass token to python api
    l

    lucasneg

    08/17/2022, 3:38 PM
    Hi I currently have a js web app that authenticates with supabase. I also have a python API that is connected to this web app. I want to secure the endpoints on this API, only allowing particular users to perform specific actions on this python API. How can I authenticate the user on the python side? Is there a token I can pass from the frontend and add to the header object of the python supabase client, and ensure the user is who they claim to be? Thanks
    g
    m
    • 3
    • 3
  • How to fetch 2 tables in one query?
    b

    bubuq

    08/17/2022, 4:03 PM
    Hi, I would like to fetch table:
    WiewiorkaMixedRubbish
    and
    WiewiorkaSegregatedRubbish
    but it shows me error: `cannot redeclare block-scoped variable 'data'
    Copy code
    js
    export const getStaticProps: GetStaticProps = async () => {
      const supabaseAdmin = createClient(
        process.env.NEXT_PUBLIC_SUPABASE_URL || "",
        process.env.SUPABASE_SERVICE_ROLE_KEY || ""
      );
    
      const { data } = await supabaseAdmin
        .from("WiewiorkaMixedRubbish")
        .select("*")
        .order("id");
      return {
        props: {
          mixedRubbish: data,
        },
      };
    // second table i wanted to query at the first supabaseAdmin query. I want return it as another prop called segregatedRubbish
      const { data } = await supabaseAdmin
        .from("WiewiorkaSegregatedRubbish")
        .select("*")
        .order("id");
      return {
        props: {
          segregatedRubbish: data,
        },
      };
    
    };
    how can i Combite 1 data query with another table called
    WiewiorkaSegregatedRubbish
    ?
    g
    • 2
    • 7
  • SvelteKit and Authentication—server- or client-side?
    s

    Smardrengr

    08/17/2022, 5:26 PM
    Struggling to know “the best way” of doing
    auth
    in a SvelteKit app. With Supabase, it appears you can run
    supabaseClient.auth.signIn({ email: form.email, password: form.password });
    server- or client-side: 1. Send
    username
    and
    password
    to a server-side route (
    /api/login
    ) which then runs
    supabaseClient.auth.signIn()
    server-side, gets back a user and session, registers session and returns data to client for Supabase to know who's logged in. (This is how I did my first SvelteKit + Supabase app according to

    https://www.youtube.com/watch?v=znZE6DEtVNs▾

    ) 2. Do auth in the client, then send session object back to the server so that SvelteKit's backend can register
    session
    and then knows that the user is logged-in (or not), which helps with SSR protected routes (if not logged in, redirect to
    /login
    ). This appears to be how most of the tutorials now are structured, but it feels kinda weird... Like, I feel the server should be the source of truth, not the web browser. Does this make any sense? Any thoughts or opinions?
    e
    w
    +6
    • 9
    • 99
  • functions get removed when migrate Prisma
    g

    Gruce

    08/17/2022, 5:40 PM
    Hello, My database functions and triggers gets removed when migrate Prisma.
    n
    • 2
    • 13
  • RLS not working? Wrong Command?
    d

    dubo

    08/17/2022, 6:44 PM
    When enabling RLS and writing this policy and expecting to be able to view the team when logged in but it returns an empty object. The "owner" collumn in teams is a relation to auth.users.id.
    Copy code
    create policy "Users can manage their own teams." on teams
      for all with check (auth.uid() = owner);
    I tried turning off RLS and it works fine. Am not familiar with SQL, is the above command correct?
    g
    • 2
    • 19
  • Can't upload to storage anymore
    l

    Leonardo-ironeko

    08/17/2022, 6:47 PM
    I've had a public 'avatars' bucket for months now, but all of a sudden I'm getting:
    Copy code
    error: {
        statusCode: '401',
        error: 'Invalid JWT',
        message: 'new row violates row-level security policy for table "objects"'
      }
    when trying to upload files. I've added RLS:
    Copy code
    bucket_id = 'avatars' AND storage."extension"(name) = 'jpg' AND storage."extension"(name) = 'png' AND LOWER((storage.foldername(name))[1]) = 'public' AND auth.role() = 'anon'
    But upload is still failing with:
    Copy code
    const {error, data} = await supabase.storage.from("avatars").upload(`twitter-990977436916551680.jpg`, buffer, {
        upsert: true,
      });
    did something change? How can I allow my API to upload files to storage again?
    g
    • 2
    • 3
  • Trying to use types from js-v2 returns databases but not rows
    j

    Jesse

    08/17/2022, 6:48 PM
    Copy code
    import { SupabaseClient } from "@supabase/supabase-js";
    import type { Database } from "../types";
    import { useContext } from "react";
    import { Context } from "../context";
    
    export const Context = createContext<SupabaseClient<Database> | undefined>(
      undefined
    );
    
    export const useSupabaseClient = (): SupabaseClient<Database> => {
      const client = useContext(Context);
      if (client === undefined)
        throw Error("No client has been specified using Provider.");
      return client;
    };
    const { data, error } = await supabase.from("account").select(");
    The from is autofilled by my IDE, but when selecting, it will only suggest *, not the rows. They do exist in the types.ts. Anything I am missing?
    s
    l
    • 3
    • 10
  • Notices for plpgsql
    f

    felsey

    08/17/2022, 7:50 PM
    I'm trying to write a loop over a series of records in my db and do an http_get call using plpgsql, but it seems like notices aren't included in the results UI. What's the best approach to get this info, so that I can write and debug this query?
    g
    • 2
    • 2
  • Cannot connect to realtime server
    t

    theuknowner

    08/17/2022, 8:31 PM
    I have enabled replication on my tables but I cannot connect to realtime server. My code: const mySubscription = supabase .from('*') .on('*', (payload) => { console.log('Change received!', payload) }) .subscribe() I get failed-rejected response from ws in chrome devs tab.
    g
    • 2
    • 11
  • Functions - Async Triggers
    b

    Brad Dwyer

    08/17/2022, 9:12 PM
    Trying to trigger an edge function when a row is added to our DB; I see on the supabase.com/edge-functions page that it says "Async Triggers - Invoke Edge Functions based on any event in your database" which looks like exactly what I need.. but I can't find anything about it in the docs or UI. Could someone point me in the right direction?
    g
    • 2
    • 4
  • Auth - Sign in user on root domain, share login session on (wildcard) subdomains
    j

    jltino

    08/17/2022, 10:32 PM
    I have a sign-in page on www.[my-domain].com, and I'd like that user session to carry over to my wildcard subdomains, e.g. [customer-id].[my-domain].com. Sign-in works fine on the root domain, but once I try navigating to any subdomain, no session is detected and my supabase.auth.user is null. I'd love any advice at all for how I can make this happen. I've read about ways to handle this, like setting JWT tokens in a cookie and using an iFrame to connect sessions across subdomains, but... I would have no idea how to do this in a Supabase context. If relevant: - I'm using social OAuth providers (Google, LinkedIn) - I'm using @supabase/auth-helpers- (but I'm seeing this issue anyway independent of using these helpers) - I've already included wildcard subdomains on my Supabase Auth dashboard Issues that I've checked out / asked on: https://github.com/supabase/supabase/issues/473 https://github.com/supabase/supabase/discussions/5742#discussioncomment-3416273 To be clear, redirecting to subdomains after successful auth does work for me. It's just that once I'm in those subdomains, my supabaseClient.auth.user object is null (when it's not null in my root domain). Thank you!!
    g
    • 2
    • 1
  • function addgeometrycolumn(unknown, unknown, unknown, integer, unknown, integer) does not exist
    a

    AlanK

    08/17/2022, 10:40 PM
    I have enabled the postgis extension, created a table and ran
    Copy code
    SELECT AddGeometryColumn('public','address_point_extract_wgs84','geom',4326,'POINT',3);
    the result was
    Copy code
    Failed to run sql query: function addgeometrycolumn(unknown, unknown, unknown, integer, unknown, integer) does not exist
    This has worked before so I am lost... Any advice would be helpful.
    g
    • 2
    • 3
  • verifyOtp 401 error
    o

    Olyno

    08/17/2022, 10:46 PM
    Hi Do you guys have some issues with the ``verifyOtp`` method? We're getting a 401 error "Token has expired or is invalid" on our side
    g
    s
    +2
    • 5
    • 69
  • Complete Typings
    u

    49Ryann

    08/18/2022, 1:43 AM
    Is there any plans to have Typescript build individual types, interfaces and enums from the db? These are incredibly helpful for building and typing data within the app.
    s
    s
    • 3
    • 4
  • 'Your account has reached its free project limit'
    l

    lavenderlav

    08/18/2022, 4:03 AM
    Unable to create one more free project when I only have one project created
    s
    • 2
    • 1
  • What's the best way to migrate hosted Supabase to self-hosted Supabase?
    a

    AmusedGrape

    08/18/2022, 4:16 AM
    I'm wanting to migrate my Supabase project to a self-hosted Supabase project for faster response times and data ownage. What's the best way to do this, if any? Thanks!
    s
    • 2
    • 1
12345...230Latest