Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.

Commit 9c09061

Browse files
feat: rewriting str as Enums
1 parent a400da0 commit 9c09061

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

supabase_functions/_sync/functions_client.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from ..errors import FunctionsHttpError, FunctionsRelayError
66
from ..utils import SyncClient, is_http_url, is_valid_jwt, is_valid_str_arg, FunctionRegion
77
from ..version import __version__
8+
from warnings import warn
89

910

1011
class SyncFunctionsClient:
@@ -88,13 +89,12 @@ def invoke(
8889
response_type = invoke_options.get("responseType", "text/plain")
8990

9091
region = invoke_options.get("region")
91-
try:
92-
fn_region = FunctionRegion(region)
93-
if fn_region and region != "any":
94-
headers["x-region"] = region.strip()
95-
except ValueError as e:
96-
# print(e)
97-
pass # In the future can become an error/warning.
92+
if not isinstance(region, FunctionRegion):
93+
warn(f"Use FunctionRegion({region})")
94+
region = FunctionRegion(region)
95+
96+
if region and region.value != "any":
97+
headers["x-region"] = region.value
9898

9999
body = invoke_options.get("body")
100100
if isinstance(body, str):

0 commit comments

Comments
 (0)