Skip to content

Conversation

mandarini
Copy link
Contributor

Moved from: supabase/functions-js#90
Author: @ggaabe

What kind of change does this PR introduce?

Fixes null body when user supplies Content-Type in headers of supabase.functions.invoke, ie: invoked like this

  const response = await supabase.functions.invoke("stripe-webhook", {
    method: "POST",
    headers: {
   // this causes the body to be null
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      action: "finalizeClinicSetup",
      stripeSessionId,
      userId,
    }),
  });

What is the current behavior?

The request body sent over the network will be null, instead of the supplied body value, if a Content-Type header is supplied

Please link any relevant issues here.

What is the new behavior?

If user supplies a Content-Type header, the body will contain its original value supplied by the developer

@coveralls
Copy link

coveralls commented Oct 9, 2025

Coverage Status

coverage: 95.455% (+13.0%) from 82.5%
when pulling 0054692 on fix/functions-client-fix
into 188fa17 on master.

@mandarini mandarini added the functions-js Related to the functions-js library. label Oct 13, 2025
@mandarini mandarini removed the request for review from a team October 13, 2025 13:08
@laktek laktek enabled auto-merge (squash) October 16, 2025 04:26
@mandarini mandarini added the bug Something isn't working label Oct 16, 2025
@laktek laktek merged commit 4acc802 into master Oct 16, 2025
25 checks passed
@laktek laktek deleted the fix/functions-client-fix branch October 16, 2025 07:31
@mandarini mandarini added do-not-merge Do not merge this PR. and removed do-not-merge Do not merge this PR. labels Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working functions-js Related to the functions-js library.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants