Logo-amall

Since the last update i got an error from the graphql api if i want to get all users: Incorrect graphql response Is there an issue?

Last active 3 months ago

13 replies

16 views

  • MS

    Since the last update i got an error from the graphql api if i want to get all users:

    Incorrect graphql response

    Is there an issue?

  • EL

    Can you share a bit more details? How can I reproduce this issue on my side?

  • MS

    I do the following:

  • MS

    const QUERYGETALL_USER = gql query QueryGetAllUser { users { email displayName id emailVerified createdAt roles { role } } }

    const { data, error } = await client.graphql.request(QUERYGETALL_USER)

    And i got the following error message:
    Error: incorrect response data from GraphQL server

  • MS

    If i do the same request with postman everything is working fine πŸ˜‰

  • BR

    +1
    I have the exact same issue.

    Some more info: I'm using the nhost-js (@nhost/nhost-js) library. When I use it in the frontend application all the requests work. When I use it in a serverless function I get the above error. The query/schema is the same. I do use the adminSecret prop in the serverless function runtime and not on the frontend client.

  • BR

    Found solution:

    tl;dr:
    Set the accept-encoding header to null.

    nhost.graphql.request(query,variables,{headers: {"accept-encoding": null}})
    

    Seems that the default accept-encoding header that Axios uses in a node environment causes issues. I tested it by creating my own Axios client and saw that the response was returning a *gibberish * string.

  • EL

    oh, interesting

  • EL

    Thanks for reporting this

  • EL

    I think it should be fixed by this: https://github.com/nhost/nhost/issues/1177

  • EL

    We plan to work on this the next few weeks.

  • EL

    It would be great if either of you, or both, could report your finding there in that issue. It would be helpful for us.

  • MS

    @elitan Done. Have create an comment with some details about the issue. I hope it helps πŸ˜‰

Last active 3 months ago

13 replies

16 views