Open evelant opened 8 months ago
Actually this appears to be coming from realtime. The following code:
export function listenToDbDocument<DocType extends { [key: string]: any }>(
connection: SupabaseClientType,
table_name: string,
docId: string,
onDocChange: (change: DbDocChangeType<DocType>) => void,
): () => void {
log.log(`Listening to "${table_name}" for document "${docId}"`)
connection
.from(table_name)
.select("*")
.eq("id", docId)
.single()
.then(doc => {
console.log(`got initial doc`)
})
const channel = connection
.channel(docId)
.on(
"postgres_changes",
{ event: "UPDATE", schema: "public", table: table_name, filter: `id=eq.${docId}` },
update => {
console.log(`got change`)
},
)
.subscribe()
return channel.unsubscribe
}
On every change that comes in on the postgres_changes
channel it logs JSON parse error: SyntaxError: JSON Parse error: Unexpected character: d
just before the callback is run with the update. There are no errors, the update message is fine.
Having similar issues here,
have a strange LOG JSON parse error: SyntaxError: JSON Parse error: Unexpected end of input
I log all the payload is fine
Having similar issues here, have a strange
LOG JSON parse error: SyntaxError: JSON Parse error: Unexpected end of input
I log all the payload is fine
Hey, I eventually found out that the backend inserted a wrong type to a jsonb field in supabase. However, this does not trigger any error log cuz the payload is already inside and it is assumed to be the correct type.
So either avoid this in the backend or find some ways to raise this error in supabase js
same as for me:
Error All course fetching data: [SyntaxError: JSON Parse error: Unexpected character: N]
Bug report
Describe the bug
supabase-js is logging
JSON parse error: SyntaxError: JSON Parse error: Unexpected character: d
with no stack and no further detail after successfully upserting a row to the database.To Reproduce
With the above upsert
error
isnull
but somewhere internal to supabase-js logsJSON parse error: SyntaxError: JSON Parse error: Unexpected character: d
. If I comment out this upsert operation the spurious error log goes away.Expected behavior
If there is an error supabase-js should return or throw it
Screenshots
N/A
System information
Additional context