Change from accessing Ngrok domain name to [shopname].myshopify.com

Topic summary

A developer is attempting to make GraphQL queries directly to their Shopify store’s admin API endpoint (https://{store_name}.myshopify.com/admin/api/2023-01/graphql.json) but the Node.js template defaults to routing requests through an ngrok tunnel instead.

Key Questions:

  • Whether direct store domain access is necessary during development or if the ngrok tunnel is acceptable
  • What additional requirements exist beyond requesting protected customer data access and proper scopes

Code Context:
The developer shared JavaScript code showing fetch requests to /admin/api/2023-01/graphql and a ShopifyQL query helper function.

Support Response:
Shopify support suggested a workshop guide (https://shopify.github.io/workshops/codelabs/shopifyql-with-polaris-viz/) with example code using Shopify.Clients.Graphql.

Follow-up Issue:
The developer noted they’re using v6 of the Shopify API where shopify.utils methods are deprecated, and even when trying v5 template code, queries still route through the ngrok tunnel rather than the shop domain.

Status: Unresolved. Support recommended posting the issue directly to the shopify-api-js GitHub repository for further assistance.

Summarized with AI on November 23. AI used: claude-sonnet-4-5-20250929.

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
  }
1 Like

Hi @nmywrld . We think the following workshop guide might have the solution you are looking for in it. You can find it here. The example code

app.get("/api/shopifyql/sales", async (req, res) => {
  const session = await Shopify.Utils.loadCurrentSession(
    req,
    res,
    app.get("use-online-tokens")
  );

  const client = new Shopify.Clients.Graphql(
    session.shop,
    session.accessToken
  );

  const salesData = await client.query({ // <-------this piece would make the gql request
    data: {
      query: SALES_QUERY
    },
  });

, might be relevant to your situation in this case. Hope this helps!

Hello. I was under the understanding that in V6, the shopify.utils methods are no longer used ?

i have used this piece of code in a v5 template and it still queries to the ngrok tunnel rather than the shop domain still.

If you’re still running into issues, it may be worthwhile to post your issue in the shopify-api-js public repo directly.