Unable to make graphql query when using accessMode: "offline" in Shopify app

dygerati
New Member
3 0 0

I've got a simple Shopify app that I created with the CLI, using "shopify create"

I need to fetch an offline token when it's installed since I'll be running queries periodically. However, when I use the following:

 

server.use(
      createShopifyAuth({
         accessMode: 'offline',

 

As well as enabling offline mode in the "verifyRequest" handler, I can't run graphql queries from the Next.js front-end. I've been testing this with the following simple query:

 

const GET_SHOP = gql`
   query {
      shop {
         name
         id
      }
   }
`;

const Index = () => {
   const { loading, error, data } = useQuery(GET_SHOP);

   console.log(error);
...

 

 

The above query works when in online mode, but when in offline I get the following:

 

image.png

 

Is there a way to stay in online mode, but produce an offline token for later queries as well? Or another way to address this?

0 Likes
dygerati
New Member
3 0 0

Still running into this, and I'm wondering if it's a bug or intended behavior. Any ideas?

0 Likes