I’m trying to use the shopify admin graphqlProxy based on the starter app and this tutorial https://shopify.dev/apps/getting-started/add-functionality. However await Shopify.Utils.graphqlProxy(ctx.req, ctx.res); just times out no mater what query I send to it.
In my server file:
router.post(
"/graphql",
verifyRequest({ returnHeader: true }),
async (ctx, next) => {
console.log("here");
await Shopify.Utils.graphqlProxy(ctx.req, ctx.res);
console.log("there");
}
);
My fontend component:
import { Page } from "@shopify/polaris";
import { useRouter } from 'next/router'
import {useAppBridge} from '@shopify/app-bridge-react';
import {Redirect} from '@shopify/app-bridge/actions';
import gql from 'graphql-tag';
import { Query } from 'react-apollo';
import ProductDetails from "../components/ProductDetails";
const ProductDetailsPage = () => {
const router = useRouter();
const { id } = router.query
console.log(id);
const app = useAppBridge();
const redirect = Redirect.create(app);
const indexRedirect = () => {
redirect.dispatch(Redirect.Action.APP, "/");
}
return (
// GraphQL query to retrieve products and their prices
)
}
export default ProductDetailsPage;
const GET_PRODUCTS_BY_ID = gql`
query getProduct($id:ID!) {
product(id:"gid://shopify/Product/7198994596031") {
title,
productType,
variants(first: 10) {
edges {
node {
id,
title,
selectedOptions {
name,
value
}
}
}
}
}
}
`;
the Query works as expected but when it gets to the server and uses the Shopify.Utils.graphqlProxy it just spins, no response from Shopify whatsoever.