currently I am trying to make graphQL queries to this endpoint https://{store_name}.myshopify.com/admin/api/2023-01/graphql.json. However, when using the default methods in the nodeJS template, it makes calls to an ngrok tunnel instead; https://c692-122-11-212-**.ap.ngrok.io/admin/api/2023-01/graphql
Other than making sure i have attempted to request for access to protected customer data and the right access scopes: “read_reports, read_customers, read_fulfillments, read_inventory, read_orders, read_products, read_all_orders”, what else will i need to make sure i can make valid shopifyQL queries through Graphql? Do i really need to access the store name domain when developing on a development store or is the ngrok tunnel ok?
Here are the relevant code
// [page name].jsx
const handleAnalytics = async () => {
setIsLoading(true);
const response = await fetch("/admin/api/2023-01/graphql", {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlenconded',
Accept : 'application/json'
}
});
setIsLoading(false);
console.log(await response)
// file name: index.js
app.post("/admin/api/2023-01/graphql", async (_req, res) => {
const data = await fetchAnalytics(res.locals.shopify.session);
res.status(200).send({data})
});
// Helper function
const analytics_query = `query{
shopifyqlQuery(query: "FROM orders SHOW sum(net_sales)") {
__typename
... on TableResponse {
tableData {
unformattedData
rowData
columns {
name
dataType
displayName
}
}
}
parseErrors {
code
message
range {
start {
line
character
}
end {
line
character
}
}
}
}
}`
export default async function fetchAnalytics (session) {
const client = new shopify.api.clients.Graphql({session});
res = await client.query({
data: {
query: analytics_query
}
});
return res
}