Admin App not Authenticated?

While I’m a seasoned coder, I am very new to shopify app development. I created an app with 2 sub-pages from the initial framework. I’m starting with a simple graphQL query to get data on one of the locations in our store.

When I try to access the page with the query, I get this:

… each time.

Here’s the code for the page:

import { authenticate } from "../shopify.server";

// This is the server-side loader function that runs when the route is loaded
export const loader = async ({ request }) => {
  const { admin} = await authenticate.admin(request);

  const quarantineLocation = "US Quarantine";

  // Get the US Quarantine location ID
  const LOCATION_QUERY = `#graphql
    query {
      locations(first: 1, query: "name:\\"US Quarantine\\"") {
        edges {
          node {
            id
            name
          }
        }
      }
    }
  `
  const queryResult = await admin.graphql(LOCATION_QUERY);
  const locationData = await queryResult.json();
  console.log(locationData);

  return locationData;
}

I’ve registered the app with the Partners website and I believe I have granted it all permissions.

My .toml file has my scopes set correctly and I am not sure what I am doing wrong.

Any help would be very much appreciated!

Scott.

Hey @RSL_IT,

I think this may be due to the fact you are not returning the data from your loader as a response. You can try using the json utility from @remix-run/node (being deprecated) or just returning a valid Response.

Hope this helps!