https://supabase.com/ logo
Join Discord
Powered by
# help-and-questions
  • Auth UI
    d

    DisamDev

    02/18/2023, 7:04 PM
    I saw this UI in the Auth UI docs but in the library there isn't look like that, the colors are different, font and the modals, how can I create this UI?
    s
    • 2
    • 2
  • How supabase auth JWTs work?
    a

    alpha_

    02/18/2023, 7:13 PM
    I couldn't find how the supabase auth JWTs are stored/encrypted in the browser with docs provided and also would like to know about how those are handled as well?
    g
    • 2
    • 2
  • how does signin with google actually work
    h

    Holland

    02/18/2023, 7:27 PM
    So I notice on websites I use, they have a signup with google option then a signin with google option. In supabase there is only the signInWithOAuth() function. How can I force users to signup with google before they signin? And is this the correct way to go about things. Signup with google first then signin with google.
    j
    • 2
    • 6
  • Greater than query on JSONB column in SupabaseJS client
    e

    Eidur

    02/18/2023, 8:13 PM
    I'm trying to filter a list of products by a price that's in a JSONB column. This is an sql example of what I want to do
    Copy code
    sql
    select * from public."products" 
    where ("shopPrices"->>'productWholesalePrice')::numeric > 500;
    This works exactly as expected. Finds one product that has the exact price of 51.05.
    Copy code
    js
    const products = await supabase
        .from('products')
        .select('*')
        .eq('shopPrices->>productRetailPrice', 51.05);
    This does not work. It finds a bunch of products with price lower than the specified 500.
    Copy code
    js
    const products = await supabase
        .from('products')
        .select('*')
        .gt('shopPrices->>productRetailPrice', 500);
    I'd appreciate any help ❤️
    g
    • 2
    • 5
  • app_metadata vs custom table
    y

    yayza_

    02/18/2023, 8:44 PM
    Regarding any future supabase changes, Is it safe to use app_metadata & user_metadata (for strict vs user editable fields) as opposed to creating a custom profile table? It seems much easier to maintain for me and my code is cleaner using the supabase admin methods. But iirc I read a message on discord or github that supabase can modify auth.users table at any time, but I'm hoping this doesn't affect the metadata objects. Just wanted to be sure 🙂 .
    g
    • 2
    • 5
  • Create an Oauth2 flow with Supabase auth
    n

    Neil Savin

    02/18/2023, 9:34 PM
    I would like my user to be able to connect from third party app to my own application. I need to create an Oauth2 flow. I need two endpoints :  1) An authorization endpoint that asks the user to sign in if they aren't, and and then redirects back to the supplied redirect URI. It would likely need to encode the user's access token and refresh token in the
    code
    parameter sent to the redirect URL, as well as pass through the
    state
    parameter. 2) A token endpoint, that takes in the authorization code, decodes it, and send back the access token and refresh token. I can’t find any resources on how to do this… especially for generating an access_token for user on commands. Do you have an idea on how to solve this ?
    s
    • 2
    • 6
  • Encrypting a single column in an existing table
    p

    Poutine Italienne

    02/18/2023, 10:34 PM
    Hello I have an existing table and I would like to encrypt a single column from it following the method described in this post https://supabase.com/blog/transparent-column-encryption-with-postgres I have successfully created a pgsodium key using
    Copy code
    sql
    select * from pgsodium.create_key();
    in the SQL editor of my project However when I attempt to run the following (in the sql editor of my project)
    Copy code
    sql
    SECURITY LABEL FOR pgsodium
        ON COLUMN server_settings.sftp_password
        IS 'ENCRYPT WITH KEY ID MY_UUID_KEY_HERE';
    I get the following SQL error
    Failed to run sql query: must be owner of event trigger pgsodium_trg_mask_update
    I guess I'm doing something wrong but I'm not too sure what. Thanks a lot.
    s
    b
    • 3
    • 10
  • SQL -> Supabase JS
    m

    mjs

    02/18/2023, 10:36 PM
    How can I do this SQL query in Supabase JS?
    Copy code
    SELECT companies.*
    FROM companies
    LEFT JOIN company_admins ON companies.id = company_admins.company_id
    LEFT JOIN company_members ON companies.id = company_members.company_id
    WHERE company_admins.user_id = <logged_in_user_id>
       OR company_members.user_id = <logged_in_user_id>;
    I'm not using SSR, so I'm just using
    useEffect
    and
    useState
    to set local UI state when data is fetched. Thanks
    g
    • 2
    • 1
  • StorageApiError: The resource was not found
    h

    Hypersigils

    02/18/2023, 10:38 PM
    When I try to load a signed URL for an image, it fails. I'm not sure why--the image is there, the bucket is public, and loading an image from a different bucket works. Can anyone figure out what's going on here?
    Copy code
    const { data, error } = await supabase
        .storage
        .from('maps')
        .createSignedUrl(map.src, 600);

    https://i.imgur.com/uBuVolf.png▾

    https://i.imgur.com/JBKotQU.png▾

    https://i.imgur.com/uzl3qN9.png▾

    g
    • 2
    • 2
  • NextJS + Supabase + TRPC setup of contexts. Anyone familiar?
    d

    DYELbrah

    02/18/2023, 10:54 PM
    When using ssg to prefetch / fetch on the server (inside getServerSideProps), I need to pass a createContext object to the ssg:
    Copy code
    const ssg = createProxySSGHelpers({
        router: appRouter,
        ctx: createTRPCContext({
          req: context.req as NextApiRequest,
          res: context.res as NextApiResponse,
        }),
        transformer: superjson,
      });
    I'm using the createTRPCContext from create T3 app. Is this okay to do? I have to pass the req and res from the context because I have a Supabase server client in the background that needs that information:
    Copy code
    export const createTRPCContext = (_opts: CreateNextContextOptions) => {
      const supabase = createServerSupabaseClient<Database>({
        req: _opts.req,
        res: _opts.res,
      });
      return createInnerTRPCContext({
        supabase,
      });
    };
    s
    s
    • 3
    • 5
  • Keep losing SessionContext, 400 errors w/ DB interaction.
    j

    JH175

    02/19/2023, 12:28 AM
    Working on a Next project. I sign in with email/password, redirect to dashboard and seem to lose session/user.id context before I can interact with the DB (400 errors). I've never had this issue before. Also: which approach is the most current: https://supabase.com/docs/guides/getting-started/quickstarts/nextjs or https://supabase.com/docs/guides/getting-started/tutorials/with-nextjs... I'm using the later with createBrowserSupabaseClient. Thanks, -Jake
  • validate token
    d

    Drip

    02/19/2023, 1:31 AM
    I see I'm able to check the token expiration to log a user out if their session token is expired, but is there a way to validate whether the user has an invalid JWT in the session? I'd prefer to log the out user right away rather than relying on RLS
    g
    • 2
    • 3
  • Supabase DB - Docker Compose UP problem
    c

    Crownie

    02/19/2023, 1:39 AM
    anyone knows how to fix this?
    s
    • 2
    • 2
  • C# Postgresql Bug or expected behaviour with `IgnoreOnInsert = true` attributes
    u

    Unknown Member

    02/19/2023, 2:11 AM
    Hey @acupofjose I am not sure whether this is a bug or expected behaviour, but when I insert with columns marked with
    IgnoreOnInsert
    it works on the Supabase side of things, as I expected the timestamps to be generated there. However, when the Postgresql client returns the
    ModeledResponse
    , the columns marked with the said attributes are blank. screenshots are included below P.S Ty for making this client I am learning so much about C#!!!!! ❤️
    g
    a
    • 3
    • 5
  • .update() returns 200, data not updated
    m

    moarwick

    02/19/2023, 2:56 AM
    Hello, just need a sanity check. Using the JS lib 2.8.0, following the docs to update an attribute in a single record, all seems fine (200) but the DB row isn't modified 😬
    Copy code
    await supabase
              .from("vendors")
              .update({ expense_category_id: expenseCategoryId })
              .eq("id", id)
              .select();
    The
    vendors
    table has a RLS Policy for UPDATE:
    (auth.uid() = user_id)
    The returned record is unmodified. Anything I could be missing??
    g
    • 2
    • 3
  • User based login on server using jwt error
    j

    jar

    02/19/2023, 3:10 AM
    I am trying to pass access_token in Authentication header to server function and login to as user to make crud requests to supabase as the user from server. I believe ive see similar questions on here but i must be doing something wrong. https://github.com/supabase/supabase/discussions/2125 My sveltekit front end with logged in user seams to successfully send access_token like such
    Copy code
    const response = await fetch('/api/user', {
              method: 'GET',
              headers: {
                'content-type': 'application/json',
                'Authorization': 'Bearer ' + session?.access_token
              }
            });
    My server component in +server.js in sveltkit looks like this
    Copy code
    import { createClient } from '@supabase/supabase-js'
    import { env } from '$env/dynamic/public';
    
    export async function GET(event) {
      try {
        console.log('getUserData')
        const authHeader = event?.request?.headers?.get('Authorization')
        console.log('authHeader',authHeader)
        if(!authHeader){
          return new Response(JSON.stringify({ message: 'No Authorization Token Provided'}, { status: 401 }))
        }
        const supabaseClient = createClient(env.PUBLIC_SUPABASE_URL, env.PUBLIC_SUPABASE_ANON_KEY, {
          auth: {
            autoRefreshToken: false,
            persistSession: false,
            detectSessionInUrl: false
          }
        })
        const res = await supabaseClient.auth.getUser(authHeader)
        console.log('userres',res)
    successfully prints jwt and i want to get the user sub and login as user but user res says
    Copy code
    userres {
      data: { user: null },
      error: AuthApiError: This endpoint requires a Bearer token
          at /node_modules/@supabase/gotrue-js/dist/main/lib/fetch.js:41:20
          at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
        __isAuthError: true,
        status: 401
      }
    }
    • 1
    • 2
  • what does a custom domain do?
    j

    jar

    02/19/2023, 3:22 AM
    I bought the custom domain and it says verified not sure if I even followed the process correctly like changing CNAME after or whater. No clue what they were talking about but it says verified. If i add phot to storage still says gibberish url. When i sign in with magic link still get email from supabase. What am i getting from custom domain?
  • Is it possible to order by distance using the `<->` operator?
    l

    laubonghaudoi

    02/19/2023, 4:01 AM
    The
    <->
    operator is from
    pg_trgm
    extension, I know I can write a rpc function call or order my query results by distance. But I like to use
    .order()
    directly in JavaScript. is it possible to do so? I checked the doc and this isn't mentioned https://supabase.com/docs/reference/javascript/order
  • MFA
    s

    Smiley

    02/19/2023, 4:21 AM
    Following the supabase docs for MFA(https://supabase.com/docs/guides/auth/auth-mfa), there is provided code how to enroll a user into MFA: However, the enroll function keeps creating a new enrollment factor on refresh. If a user will keep refreshing the website too many times, he'll get the enrolled factors exceed allowed limit error. Is there a way to reuse a previous enrollment if one exists to stop generating qr codes?
    u
    j
    k
    • 4
    • 13
  • How to correctly deal with realtime updates?
    g

    Gitanes

    02/19/2023, 5:44 AM
    So I'm building this social network and let's take for example the messaging service. I'm using Alpine and Vercel APIs with Supabase. I want to update the conversation when one or both users send a message. How should I do this? I've put the listener (a fetch) in a x-effect but it doesn't seem right. Can anybody explain to me how to achieve realtime updates with this stack?
    • 1
    • 1
  • How to use third party library inside a supabase postgres plv8 function?
    b

    bilals

    02/19/2023, 6:39 AM
    I am trying to use these libraries inside my supbase function. The function can be created without any issue, but when running it, i am getting this error: > Failed to run sql query: TypeError: plv8.requires is not a function This is my function: > CREATE OR REPLACE FUNCTION login(req json) > RETURNS json AS $$ > > const supabase = plv8.require('supabase-js'); > const { parsePhoneNumber } = plv8.require('google-libphonenumber'); > const { v1: uuidv1 } = plv8.require('uuid'); > const hashJs = plv8.require('hash.js'); > const Hashids = plv8.require('hashids/cjs'); > > // My JS code > > $$ LANGUAGE plv8;
    j
    g
    • 3
    • 8
  • create view or add leftjoin
    n

    Naviz

    02/19/2023, 7:22 AM
    `.from("users") .select(
    full_name, phone, user_group.group_id
    ) .leftJoin('user_group', 'users.id', 'user_group.user_id') .eq('user_group.group_id', group_id) if (error) { throw error; }` Como puedo crear esa consulta? intenté crear una view pero no puedo hacerlo dinamico. ayudaaa!!
    s
    • 2
    • 1
  • Pls help is newbie of supabase (not being able to fetch data)
    a

    Avinier

    02/19/2023, 7:32 AM
    So I'm not being able to fetch my data from the database i created, it's a simple function, idk what's going on, no errors too. here's my table- and my code-
    Copy code
    export default function Home() {
      const [fetchedData, setFetchedData] = useState(null);
    
      useEffect(() => {
        async function fetchData() {
          try {
            let { data: cardata, error } = await supabase
              .from("Cardata")
              .select("*");
    
            if (error) {
              console.log(error);
            }
            if (data) {
              setFetchedData(data);
              console.log(cardata);
            }
          } catch (err) {
            console.log(err);
          }
        }
        fetchData();
      }, []);
    
    return <h1>WELCOME</h1>
    and the console (no errors, just an empty array)
    b
    • 2
    • 4
  • Hi, when i want to migrate my prisma with pnx prisma migrate dev --name init, i have this error :
    i

    ioTactile

    02/19/2023, 10:12 AM
    I'm using sveltekit supa and prisma
    g
    • 2
    • 1
  • Flutter auth management example - unexpected error occurred, no logs
    b

    Blob

    02/19/2023, 11:28 AM
    Been playing with Flutter, created a SB project, followed the user management example, corrected the createState() lines, gave myself an invite, which I accepted. But that invite redirected the localhost:3000, so I'm not sure if the account was properly set up. I did not have a chance to set a password. When running the Flutter example, I have to provide that email address to receive an OTP. However there's an error message "An unexpected error occurred ... ". Checking the SB frontend I see nothing in the logs. There's also nothing in the client's logs. Now what? How do you debug something that has no logs?
    g
    • 2
    • 4
  • 502 error / CPU execution time exceeded when executing an edge function
    b

    British Dominic

    02/19/2023, 11:31 AM
    I have a transform script that extracts data from a json blob and puts the data into a different table numerous columns. For smaller amounts of data (300-600 rows) it works fine, but when there's more data to process it seems to fail. I've tried increasing the timeout in the edge function but that didn't work. I'm calling the edge function via the rest API. Seems to error after about 16 seconds. What can I do to make this work?
    • 1
    • 1
  • Correctly decrypting pgcryto encoded value using the Javascript SDK
    p

    Poutine Italienne

    02/19/2023, 11:56 AM
    Hello I have a column value encrypted using pg crypto. I am able to decrypt it without any issue within the SQL editor. However when I try to use the select method in the supabase.js api I get the following error. This is my query
    Copy code
    js
    supabase.client
            .from('servers')
            .select(`
                    server_name,
                    server_settings (
                        sftp_ip,
                        sftp_port,
                        pgp_sym_decrypt(sftp_password::bytea, '${env.SUPABASE_ENCRYPTION_KEY}')
                    )`
            )
    Using `pgp_sym_decrypt(sftp_password::bytea, '${env.SUPABASE_ENCRYPTION_KEY}')`in my select statement causes the following error. Removing the single quote also causes an error.
    Copy code
    An error occurred while fetching server settings {
      code: 'PGRST100',
      details: `unexpected "'" expecting field name (* or [a..z0..9_$]) or "*"`,
      hint: null,
      message: `"failed to parse select parameter
    What's the correct way of decrypting a field using pgcrypto in with the javascript SDK? Thank you in advance
    • 1
    • 1
  • Google SSO SAML 2.0 Implementation for client
    m

    melkotoury

    02/19/2023, 12:06 PM
    Hi , Me and my team were considering using Google SSO for our client , using SAML 2.0 protocol , wanted to know if this feature is fully supported inside Supabase or is it just available to access the Supabase Dashboard ? because we are researching whether Supabase is a good fit for the project we are currently working on
  • HTML TO PDF Using puppeteer
    m

    MaxAryus

    02/19/2023, 12:35 PM
    Does anbybody know if there is a way to convert html to pdf with edge functions? I saw that you can take a screenshot but turning that code into generating an pdf does not work https://github.com/supabase/supabase/tree/master/examples/edge-functions/supabase/functions/puppeteer
    s
    • 2
    • 1
  • npm install error for libpg-query
    l

    Lappp

    02/19/2023, 1:14 PM
    I would like to contribute to supabase's code base through their Good First Issues but I can't seem to get npm install running locally. 1. I've forked the repo, cloned it and run
    npm install
    locally 2. But I seem to keep getting this error, logs are below. Stuff that I've tried. 1. Thought it was an
    npm cache
    issue, ran
    npm install --cache ./temp-cache
    to test, but it still gets stuck here. 2. Reinstalled VS Build Tools 2019 , as I read somewhere that node-gyp needs it so I thought a fresh installation might help. 3. Run
    npm install -g node-gyp
    and it installs successfully and I can get its version, but
    npm install
    still fails there. Any ideas?
    s
    • 2
    • 2
1...137138139...230Latest