Skip to content

Cannot call supabase_functions.http_request inside another function #15379

Closed Answered by Eldynn
Eldynn asked this question in Questions
Discussion options

You must be logged in to vote

ended up creating my own function like the one in supabase_functions:

CREATE SCHEMA IF NOT EXISTS not_public;

CREATE OR REPLACE FUNCTION not_public.base_url()
 RETURNS text
 LANGUAGE plpgsql
AS $function$
  DECLARE
    base_url text;
  BEGIN
    select decrypted_secret
    into base_url
    from vault.decrypted_secrets
    where name = 'SUPABASE_URL';

    IF base_url IS NULL THEN
      RAISE EXCEPTION 'base_url is not configured?';
    END IF;

    return base_url;
  END
$function$;

CREATE OR REPLACE FUNCTION not_public.functions_default_headers()
 RETURNS jsonb
 LANGUAGE plpgsql
AS $function$
  DECLARE
    supabase_anon_key text;
    headers jsonb;
  BEGIN
    select decrypted_secret
…

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@Eldynn
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@tecoad
Comment options

Answer selected by Eldynn
Comment options

You must be logged in to vote
1 reply
@Eldynn
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants