hoppscotch / hoppscotch-extension

🧩 Browser extensions to provide more capabilities to https://hoppscotch.io
https://hoppscotch.io
MIT License
254 stars 95 forks source link

GraphQL support broken (once again) #12

Closed levrik closed 4 years ago

levrik commented 4 years ago

Describe the bug

GraphQL requests work in general but I can't see the response from server. Neither if the request was successful or not (means contains errors or not). Instead I'm just getting SyntaxError: Unexpected token in JSON at position 85. Check console for details.. With a different position depending on the actual JSON returned by server. I think the unexpected token seems to be a space? Sadly I can't check the response since this is routed through the extension. Some debug mode for the extension would be great, that it logs request/response pairs or similar. I can file another issue for this if it sounds good to you.

To Reproduce Steps to reproduce the behavior:

  1. Go to GraphQL section
  2. Get the schema (works fine)
  3. Enter some query or mutation
  4. Send it and see this error described above.

Expected behavior Returned JSON to be shown

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context

It's starting to get kinda "funny". Every time I'm using this application, something else is broken. Most of the time around GraphQL support, sometimes also just in general. I really like the look and feel of this application and it really makes me sad that every time I want to use some fundamental functionality is broken.

liyasthomas commented 4 years ago

I just tried at my end. And it's working fine. Can you produce a screenshot of a errored query/mutations?

levrik commented 4 years ago

image

The query/mutation I'm entering doesn't matter. I'm always ending up with this.

levrik commented 4 years ago

I can even reproduce this error with "Get schema" when using https://rickandmortyapi.com/graphql as endpoint. Maybe this helps you reproducing it yourself? For the example above, I've used our own GraphQL API. "Get schema" was working there but I'm hitting this issue on normal requests then.

liyasthomas commented 4 years ago

Make sure you turned off Proxy mode and Extension mode from Settings. Make sure you're using latest GraphQL query syntax.

  1. Visit https://hoppscotch.io/graphql
  2. Endpoint: https://rickandmortyapi.com/graphql
  3. Query:
query GetCharacter($id: ID!) {
  character(id: $id) {
    id
    name
  }
}
  1. Send

If this doesn't work, try cleaning site's cache. And try again.

levrik commented 4 years ago

@liyasthomas Yep. This is working fine so the problem is probably the extension.

AndrewBastin commented 4 years ago

Yup, this is known :sweat_smile: . I just couldn't get to the bottom of the issue yet, because it is a bit random.

Trying to work on a fix for that soon. I am busy working on the Teams system. Closing this issue as it is basically same underlying issue as #11