supabase-js icon indicating copy to clipboard operation
supabase-js copied to clipboard

"Unexpected end of JSON input"

Open mimranzulkfal opened this issue 1 year ago • 0 comments

Bug report

Getting error "Unexpected end of JSON input" on calling Netlify graphql function endpoint.

Describe the bug

When I perform updateUser or createUser, fetchData hook is called which call the function endpoint, data is perfectly stored in the supabase DB but the response returned is not in the correct way. I'm getting this error (res.json() response):

Object { “data”: null, “errors”: Array [ Object { “extensions”: Object { “code”: “INTERNAL_SERVER_ERROR”, “exception”: Object { “clientVersion”: “2.30.3”, }, }, “locations”: Array [ Object { “column”: 3, “line”: 3, }, ], “message”: “Unexpected end of JSON input”, “path”: Array [ “updateUser”, ], }, ], }

when I hit https://{myAppDomain}/.netlify/functions/{functionName}

Logs

Response when fetching Netlify's graphql function endpoint:

{"type":"default","status":200,"ok":true,"statusText":"","headers":{"map":{"server":"Netlify","content-type":"application/json","strict-transport-security":"max-age=31536000","age":"1","content-length":"211","date":"Tue, 21 Mar 2023 20:39:06 GMT","x-nf-request-id":"01GW2YB6B7VJFSYQMG1ZAXK2XK","cache-control":"no-cache"}},"url":"https://{myAppDomain}/.netlify/functions/{functionName}","bodyUsed":false,"_bodyInit":{"_data":{"size":211,"offset":0,"blobId":"AB02031A-B64F-42ED-B523-153EBFB6D12C","type":"application/json","name":"graphql","__collector":{}}},"_bodyBlob":{"_data":{"size":211,"offset":0,"blobId":"AB02031A-B64F-42ED-B523-153EBFB6D12C","type":"application/json","name":"graphql","__collector":{}}}}

JSON Object logged (res.json())

json Object { "data": null, "errors": Array [ Object { "extensions": Object { "code": "INTERNAL_SERVER_ERROR", "exception": Object { "clientVersion": "2.30.3", }, }, "locations": Array [ Object { "column": 3, "line": 3, }, ], "message": "Unexpected end of JSON input", "path": Array [ "updateUser", ], }, ], }

System information

  • OS: [e.g. macOS, Windows]
  • Browser (if applies) [e.g. chrome, safari]
  • Version of @supabase/gotrue-js: [1.18.0]
  • Version of @supabase/supabase-js: [1.25.1]
  • Version of Node.js: [16.17.0]

Additional context

I'm using Netlify, Prisma, and Supabase but not getting exactly where this issue can be. Please help me to figure out this issue.

Thanks

mimranzulkfal avatar Mar 23 '23 19:03 mimranzulkfal