Closed probablykasper closed 8 months ago
The stack trace seems to points to this line (probably a bad source map)
Hmm the trace points to PostgrestBuilder.ts:70
which looks right:
So it comes from the fetch
invocation. I suspect the browser's native fetch
is logging all 4xx
s - the way we do maybeSingle()
is we do single()
but ignore the error, so the 406
comes from PostgREST. Should be harmless, but noisy - I suppose we could instead treat it as a non-single()
and just throw if there are >1 rows.
the way we do maybeSingle() is we do single() but ignore the error, so the 406 comes from PostgREST
Not ideal to ignore the error on the client as the logs would also still contain the 406. I think https://github.com/PostgREST/postgrest/pull/2164#issuecomment-1165035270 would be the ideal solution.
(basically a header that defines expected number of returned rows)
Gotcha, changing this issue to track refactoring the code to use that feature once it's out :+1:
Hi @soedirgo Any update on when this might be addressed?
@brentrobbins can try to npm update @supabase/postgrest-js
? This should fix most of the cases, the rest will need some changes on PostgREST proper
I am using @supabase/postgrest-js@1.7.2
and I'm still having the issue where the API returns 406
errors when using .maybeSingle()
.
This seems to be a mistake. I would expect this type of query to return a 200 status with a null result, as opposed to a non-200 status.
Any update on this? For us the issue appears to be this line: https://github.com/supabase/postgrest-js/blob/v0.37.4/src/lib/types.ts#L151 which contains hard coded Results contain 0 rows
, currently the endpoint returns The result contains 0 rows
in the details
On PostgREST 11.2.0, the format of the error got changed on https://github.com/PostgREST/postgrest/pull/2876 to "The result contains 0 rows".
I didn't know postgrest-js
was relying on the messages. For now we could change the detection to 0 rows
. This should work for previous and newer versions.
:tada: This issue has been resolved in version 1.8.5 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Bug report
Describe the bug
When selecting using
.maybeSingle()
, I'm getting an error logged to console if there's 0 rows returned. There's no error if I remove.maybeSingle()
, and there's no error if a row is returned.To be clear, the query still returns successfully.
The stack trace seems to points to this line (probably a bad source map): https://github.com/supabase/postgrest-js/blob/84f151834a4e305508cd246cba9ea33e6affc0f2/src/PostgrestBuilder.ts#L102
To Reproduce
System information