Anyone had this before? ```ts const { data, error,...
# javascript
s
Anyone had this before?
Copy code
ts
const { data, error, count } = await supabase
    .from('jobs')
    .select('id', { count: 'exact', head: true })
    .gt('valid_until', 'now()')
    .neq('closed', 'true');
Copy code
bash
invalid json response body at https://cdylbjsfwtolxghadbnk.supabase.co/rest/v1/jobs?select=id&valid_until=gt.now%28%29&closed=neq.true reason: Unexpected end of JSON input

FetchError: invalid json response body at https://cdylbjsfwtolxghadbnk.supabase.co/rest/v1/jobs?select=id&valid_until=gt.now%28%29&closed=neq.true reason: Unexpected end of JSON input
    at C:\Users\matt\proj\bread\node_modules\node-fetch\lib\index.js:272:32
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
s
Hm, how many rows does your
jobs
table have?
s
It's happening in every environment, Dev only has 12 rows
If I move the api call out of
load
and into
onMount
I now get some feedback... API call comes back
200 OK
but then when I run
await response.json()
I get
Copy code
Uncaught (in promise) SyntaxError: Unexpected token T in JSON at position 0
Oh... the response is not json?
Copy code
js
body: ReadableStream
bodyUsed: true
headers: Headers {}
ok: true
redirected: false
status: 200
statusText: "OK"
type: "basic"
url: "http://localhost:3000/api/count"
[[Prototype]]: Response
FML that was it
GG
Thanks steve
s
Ah, that makes sense. When you do
head: true
the response body is actually empty(supabase-js does a HEAD request).
s
The bit I still don't understand is shouldn't this have always failed??? It would work on first load, then revisiting resulted in a failure. So weird
Anyway, it seems to be working now