Skip to content

functions.invoke fails when passing in custom Cronet #1149

Open
@DanMossa

Description

@DanMossa

Describe the bug
When passing in a custom Http Client to Supabase's instantiation, functions.invoke fail with a 400 error.

FunctionException(status: 400, details: <html>
<head><title>400 Bad Request</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<hr><center>cloudflare</center>
</body>
</html>
, reasonPhrase: )

To Reproduce

        final engine = CronetEngine.build(
          cacheMode: CacheMode.memory,
          cacheMaxSize: _maxCacheSize,
          enableHttp2: true,
        );
        final client = CronetClient.fromCronetEngine(engine);

    await Supabase.initialize(
      url: Config.supabase.url,
      anonKey: Config.supabase.anonKey,
      authOptions: const FlutterAuthClientOptions(authFlowType: AuthFlowType.implicit),
      httpClient: client,
    );

Supabase.instance.client.functions.invoke('call-edge-function')

Expected behavior
I expect the function to be correctly invoked without an errors, just like it happens when no or a regular HttpClient is passed in

Version (please complete the following information):
supabase_flutter 2.8.3
supabase 2.6.2
functions_client 2.4.0
gotrue 2.11.1
postgrest 2.4.1
realtime_client 2.4.1
storage_client 2.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfunctionsThis issue or pull request is related to functions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions