• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / supabase-flutter / 36606520173
94%

Build:
DEFAULT BRANCH: main
Ran 29 Sep 2026 05:41PM UTC
Jobs 11
Files 171
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

29 Sep 2026 05:39PM UTC coverage: 91.234% (+0.01%) from 91.223%
36606520173

push

github

web-flow
fix(functions): decode response bodies that are not valid UTF-8 instead of throwing (#1892)

## What

`FunctionsClient.invoke` decodes text bodies with
`utf8.decode(bodyBytes, allowMalformed: !isSuccessStatus)` at both call
sites in `functions_client.dart`, so an error body that is not valid
UTF-8 decodes with U+FFFD in place of the bad bytes and still reaches
the caller as the exception `details`. A success body stays strict, the
same way the JSON branch already rethrows on a malformed success body.

## Why

Both `utf8.decode` calls used the default `allowMalformed: false`. A
response body that is not valid UTF-8, for example `Café` sent as
ISO-8859-1 (`43 61 66 E9`) by an Edge Function or a proxy in front of
it, threw a bare `FormatException` out of `invoke`:

| Response | `main` | this PR |
|---|---|---|
| 200 `text/plain`, body `43 61 66 E9` | `FormatException: Unfinished
UTF-8 octet sequence (at offset 4)` | `FunctionResponse(data: 'Caf�',
statusCode: 200)` |
| 500 `application/json`, body `<html><body>Caf\xE9</body></html>` |
`FormatException: Missing extension byte (at offset 16)` |
`FunctionsApiException(statusCode: 500, details:
'<html><body>Caf�</body></html>')` |

The second row is the bug: a gateway error page in Latin-1 already fails
the JSON decode, and the fallback decode in the `on FormatException`
handler threw a second `FormatException` from inside the handler, so the
status code and body were lost and `on FunctionException` handlers never
ran.

functions-js reads these bodies with `response.text()`, whose decoder is
non-fatal and substitutes U+FFFD
(`packages/core/functions-js/src/FunctionsClient.ts`); this PR takes
that only for the error path. Valid UTF-8 decodes exactly as before.

## Not a breaking change

No public API changes. Bodies that decoded before decode to the same
string, and a malformed success body throws as before.

## Tests

`packages/supabase_functions/test/functions_dart_test.dart`, two new
cases driven by two ne... (continued)

2 of 2 new or added lines in 1 file covered. (100.0%)

8794 of 9639 relevant lines covered (91.23%)

4.95 hits per line

Jobs
ID Job ID Ran Files Coverage
3 supabase_flutter - 36606520173.3 29 Sep 2026 05:41PM UTC 14
78.5
GitHub Action Run
4 iceberg - 36606520173.4 29 Sep 2026 05:41PM UTC 6
68.52
GitHub Action Run
5 supabase_storage - 36606520173.5 29 Sep 2026 05:43PM UTC 9
97.83
GitHub Action Run
6 supabase_auth - 36606520173.6 29 Sep 2026 05:45PM UTC 32
92.1
GitHub Action Run
7 supabase_realtime - 36606520173.7 29 Sep 2026 05:44PM UTC 13
90.66
GitHub Action Run
8 supabase_functions - 36606520173.8 29 Sep 2026 05:41PM UTC 4
96.0
GitHub Action Run
9 supabase - 36606520173.9 29 Sep 2026 05:47PM UTC 18
93.71
GitHub Action Run
10 postgrest - 36606520173.10 29 Sep 2026 05:43PM UTC 28
94.17
GitHub Action Run
11 supabase_typegen - 36606520173.11 29 Sep 2026 05:43PM UTC 24
95.57
GitHub Action Run
8 supabase_common - 35998092270.8 24 Sep 2026 12:18PM UTC 22
87.5
GitHub Action Run
2 yet_another_json_isolate - 35608843571.2 21 Sep 2026 01:58PM UTC 1
98.44
GitHub Action Run
Source Files on build 36606520173
  • Tree
  • List 171
  • Changed 4
  • Source Changed 3
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #36606520173
  • 56950108 on github
  • Prev Build on main (#36568174948)
  • Next Build on main (#36609100064)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc