supabase / postgrest-js

Isomorphic JavaScript client for PostgREST.

Home Page:https://supabase.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`count: exact` and `head: true` hides errors

steve-chavez opened this issue · comments

Problem

If a table has a high count (say 30_000_000), doing:

supabase
.from('table')
.select('id', {count: 'exact', head: true})

Will result in an uninformative error:

{
error: { message: '' },
data: null,
count: null,
status: 500,
statusText: 'Internal Server Error'
}

By removing the head: true (untested, but assuming is the same as curl), we get the actual error:

{"code":"57014","details":null,"hint":null,"message":"canceling statement due to statement timeout"}

Solution

Somehow expose the error message when this happens. Not sure if possible, this might need a special status code from upstream.