Skip to content

Functions client 404s on existing functions #418

Closed
@duffn

Description

@duffn

Describe the bug

I may very well be doing something wrong here, but I cannot get the functions invoke endpoint to work. All attempts to invoke a function 404.

I can get this to work with the JavaScript client, which calls https://mysubdomain.supabase.co/rest/v1/rpc/testing_func. The Python client, however, attempts to call https://mysubdomain.functions.supabase.co/testing_func which 404s for me.

To Reproduce
Steps to reproduce the behavior:

  • Create any function.
create or replace function testing_func (
  num int
)
returns table (
  num_ret int
)
language plpgsql
as $$
begin
  return query
  select
    num;
end;
$$;
  • Attempt to invoke the function
import asyncio
import os

from dotenv import load_dotenv
from supabase import create_client

load_dotenv()


url = os.environ.get("SUPABASE_ENDPOINT")
key = os.environ.get("SUPABASE_PRIVATE_KEY")
supabase = create_client(url, key)
func = supabase.functions()


async def test_func():
    resp = await func.invoke(
        function_name="testing_func",
        invoke_options={
            "body": {
                "num": 1,
            }
        },
    )
    return resp


resp = asyncio.run(test_func())
print(resp)
{'data': b'Function not found', 'error': None}

Expected behavior

The function executes successfully.

Screenshots

  • n/a

Desktop (please complete the following information):

  • OS: macOS
  • Version supabase==1.0.3

Smartphone (please complete the following information):

  • n/a

Additional context

  • n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions