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

Commit cc25705

Browse files
committed
fix: wrong response on update w/o match
1 parent 933b4d6 commit cc25705

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/PostgrestBuilder.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,23 @@ export default abstract class PostgrestBuilder<Result>
106106

107107
try {
108108
error = JSON.parse(body)
109+
110+
// Workaround for https://github.com/supabase/postgrest-js/issues/295
111+
if (Array.isArray(error) && res.status === 404) {
112+
data = []
113+
error = null
114+
status = 200
115+
statusText = 'OK'
116+
}
109117
} catch {
110-
error = {
111-
message: body,
118+
// Workaround for https://github.com/supabase/postgrest-js/issues/295
119+
if (res.status === 404 && body === '') {
120+
status = 204
121+
statusText = 'No Content'
122+
} else {
123+
error = {
124+
message: body,
125+
}
112126
}
113127
}
114128

0 commit comments

Comments
 (0)