Fetching data into graphql - graphql

I am trying to execute very basic query into graphql but getting following error. any input or suggestion.

Related

Apollo Graphql - Default values on network error?

I am working with Apollo's Graphql React Client.
I would like to have some "default values" that queries return when they fail to fetch the data, for example, when offline.
I know that I can check if an error occured and populate it manually, but this means that I will have to do it and sync the data between each component that uses the useQuery hook with intersecting results.
I was unable to find anything, but is there some way/best practice to do it?
Thank you

GraphQl Request Parameters to Sql

Is there a way to build a SQL query from GraphQL parameters? Currently, we are using 'https://www.npmjs.com/package/graphql-parse-resolve-info' to get the requested fields and building queries.
However, there may be a library that can help you with this. Our tech stack is: Nestjs, GraphQL, Sequelize

Can we have GraphQL response in XML

I am trying to add a GraphQL wrapper on an existing project's REST APIs.
I need to define queries for every existing API. However, a few of them are returning XML responses.
As per my findings, GraphQL's response is always a valid JSON (Link)
Is it possible in any way to return the XML response from the GraphQL query?

AWS AppSync - GraphQL: Lambda error not resulting in errors object in AppSync response

I used to get the errors object in AppSync response and a 5xx status code - if there was an error thrown from Lambda resolver (either a timeout error or a handled error I send as the first parameter in the lambda callback)
Eg.
`callback(errorMessage, …)
I can no longer see the errors object in AppSync – even though the Lambda resolver is throwing errors.
Is this a change in implementation or a bug?
I'm having to work around this by changing the response mapping template in AppSync resolver – to use $util.error based on a flag in the Lambda response.
While doing this – I'm able to get the errors object in AppSync response – but it’s still a 200 OK response.
Any way we can override this status code in AppSync?
Have you changed the version of mapping template that you are using from 2017-02-28 to 2018-05-29? The behavior on how invocation errors are handled changes between the two versions.
A snippet from the AppSync Developer Docs:
Previously, with 2017-02-28, in case of an invocation error, the response mapping template was evaluated and the result was placed automatically in the errors block of the GraphQL response.
With 2018-05-29, we can now choose what to do with the error, re-raise it, raise a different error, or append the error while return data.
You can find the AppSync Developer Docs that I am referencing here.
Currently you cannot customize the error status code in AWS AppSync.
The suggested approach is to use errorType in the error response. You can use $util.appendError or $util.error methods in your velocity mapping template to define the error type.

When sending a GraphQL Get Request Receiving a 400 Error

I am using the Insomnia client to form GraphQL Queries.
I have the following Query
query purchaseOrders{purchaseOrders(limit: 1){poNumber}}
Sending with the Bearer Token as the only header.
I'm getting a 400 response, this is the first time I've worked with GraphQL, so I'm not sure what I'm doing wrong or how to troubleshoot.
This Query works in my sandbox.
Turns out the API isn't in production yet.

Resources