Skip to content

FunctionsClient.invoke sends lowercase HTTP method, fails with CronetClient #1352

@j8000

Description

@j8000

Bug Report

FunctionsClient.invoke() creates HTTP requests using method.name, which in Dart returns the lowercase enum value ("post", "get", etc.) instead of the RFC 7230-required uppercase ("POST", "GET").

Affected lines in packages/functions_client/lib/src/functions_client.dart:

  • Line 135: http.MultipartRequest(method.name, uri)
  • Line 139: http.Request(method.name, uri)

Why this matters

This works with IOClient (dart:io) and CupertinoClient (NSURLSession) because they normalize methods to uppercase internally. However, CronetClient from package:cronet_http — the recommended HTTP client for Android — sends the method string verbatim. The Supabase relay then rejects the request with 400 Bad Request.

Reproduction

  1. Use CronetClient as httpClient for Supabase (recommended Android setup per cronet_http docs)
  2. Call supabase.functions.invoke('my-function', body: {...})
  3. 400 Bad Request
  4. Switch to default IOClient → works fine

Suggested fix

// Line 135
request = http.MultipartRequest(method.name.toUpperCase(), uri)

// Line 139
final bodyRequest = http.Request(method.name.toUpperCase(), uri);

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions