#Using Supabase RLS with Trigger V3

1 messages · Page 1 of 1 (latest)

cloud loom
#

You can't call Trigger.dev directly from the client side (yet). We do have a plan for this in the future using pre-signed URLs, a bit like how S3 does it.

I think you just need to pass the authorization header value (opts.req.headers.authorization) in the payload to your trigger task. Then you can have a function that returns a userId and authenticated Supabase client.

We are working on adding middleware support which would allow you to easily share this logic, exactly like how tRPC does it. But that won't be available for a few weeks.

#

This does mean you'd need a Nest.js API endpoint though, or server action

#

that has access to the request object

cloud loom
#

This doesn't work?

const supabase = createClient<Database>(
        process.env.NEXT_PUBLIC_SUPABASE_URL ?? '',
        process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY ?? '',
        {
          auth: {
            autoRefreshToken: false,
            detectSessionInUrl: false,
            persistSession: false,
          },
          global: {
            headers: {
              Authorization: input.authorization,
            },
          },
        }
      );
cloud loom
#

Ok I understand. So I think you need to get the authorization value from the cookies and then pass that to the trigger function.