I’m getting the following 400 error response when making a GraphQL request from my Shopify app to the Admin API. The parameters of my GraphQL query are correct (I’ve tested it via the Shopify GraphiQL explorer), so I’m not sure how to fix it. Has anyone run into this issue before?
> {"errors":{"query":"Required parameter missing or invalid"}}>
I’m following the default tutorial on creating a Shopify app: https://shopify.dev/tutorials/build-a-shopify-app-with-node-and-react/fetch-data-with-apollo. Someone had the same problem here (https://community.shopify.com/c/Shopify-APIs-SDKs/GraphQL-Admin-interface-Error-400-Required-parameter-missing-or/m-p/552376) but I don’t see a solution.
As the tutorial suggests, I am using a proxy to forward requests to the Admin API from my server
server.use(graphQLProxy({version: ApiVersion.October19}))
My ApolloClient is including my credentials
const client = new ApolloClient({
fetchOptions: {
credentials: 'include'
},
});
And I am sending the following GraphQL query (I’ve verified the parameters are being set correctly).
import gql from 'graphql-tag';
import { Query } from 'react-apollo';
import { Card } from '@shopify/polaris';
import store from 'store-js';
const GET_PRODUCTS_BY_ID = gql`
query getProducts($ids: [ID!]!) {
nodes(ids: $ids) {
... on Product {
title
handle
descriptionHtml
id
images(first: 1) {
edges {
node {
originalSrc
altText
}
}
}
variants(first: 1) {
edges {
node {
price
id
}
}
}
}
}
}
`;
class ResourceListWithProducts extends React.Component {
render() {
return (
);
}
}
export default ResourceListWithProducts;
My Request ID is: 0624cb9c2d00000256d400a000000001
I’m new to being a Shopify developer, so any help would be very welcome. Thanks in advance!