Server Error Error: Unexpected token < in JSON at position 0

I am new to GraphQL and Apollo Client so I am not sure what could be the issue.

I am facing below error when I am trying to get posts from WordPress backend. I have used GraphQL plugin in WordPress backend.

Any help would be appreciated.

In my experience, this happens when the endpoint is returning an HTML response instead of a JSON response. In practice, this has happened when a 4xx or 5xx status page from your backend returns an HTML page, so if an exception happens or the request is not authorized for some reason, it returns a HTML formatted data, which is why the < character is being returned.