Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.
This repository was archived by the owner on Oct 9, 2025. It is now read-only.

Fetch method can't handle error response that is not a valid JSON object #241

@phamhieu

Description

@phamhieu

Bug report

Describe the bug

related to supabase/auth-js#325

} else {
error = await res.json()
if (error && this.shouldThrowOnError) {
throw error
}
}

Fetch method tries to parse error response as json before returning. Whenever the error response is not JSON object, it will not return properly instead a json parsing error will be throw.

Expected behavior

  • get error response as raw text
  • trying to parse error response as json
    • if succeed: return as json
    • else: return as text

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions