Skip to content

JSON parse error: SyntaxError: JSON Parse error: Unexpected character: d #1731

@evelant

Description

@evelant

Bug report

  • [X ] I confirm this is a bug with Supabase, not with my own application.
  • [X ] I confirm I have searched the Docs, GitHub Discussions, and Discord.

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

   const { count, data, error } = await db
                        .from(table_name)
                        .upsert(snapshot as any, { ignoreDuplicates: false, onConflict: "id" })
                        .eq("id", id)
                        .select()
                        .single()

With the above upsert error is null but somewhere internal to supabase-js logs JSON 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

  • OS: macOS
  • Browser (if applies) [e.g. chrome, safari]
  • Version of supabase-js: 2.39.3
  • Version of Node.js: N/A

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingrealtime-jsRelated to the realtime-js library.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions