Join us for an upcoming Shopify Partner webinar on February 27, 2024. Discover the latest Checkout Extensibility features, and deep dive on improvements to Shopify Functions and Web Pixels. Register now for either the 10am EST or 2pm EST sessions.

SHOPIFY Uncaught (in promise) Error: GraphQL error: Access denied for orders field

s33d
Visitor
1 0 1

I got this error to fetch orders with '@shopify/koa-shopify-auth'from a PUBLIC app.

Uncaught (in promise) Error: GraphQL error: Access denied for orders field.

The query is like this.

 

orders(first: 10, after: $cursor, query: $query, reverse: true) {
  edges {
    cursor
    node {
      currentTotalPriceSet {
        presentmentMoney {
          amount
          currencyCode
        }
      }
      tags
    }
  }
  pageInfo {
    hasNextPage
  }
}

 

with $query like this

 

let query = campaigns
   .map((campaign) => `tag:'FreeGiftCampaignId: ${campaign.id}'`)
   .join(" OR ");

 

I added reverse: true, and the scopes are correctly set

SCPOPES: read_orders,read_all_orders,write_orders,read_products,read_discounts,write_discounts,write_script_tags

 

Also the app has been approved for read_all_orders

The strange thing about this issue is that it's not happening to every merchant only some of them have this issue

if i query the scopes for a failing merchant (just before the failing call) i got this which seems totaly fine

[
  {
    "handle": "read_all_orders"
  },
  {
    "handle": "write_orders",
  },
  {
    "handle": "read_products",
  },
  {
    "handle": "write_discounts",
  },
  {
    "handle": "write_script_tags",
  },
  {
    "handle": "read_orders",
  },
  {
    "handle": "read_discounts",
  },
  {
    "handle": "read_script_tags",
  }
]

 

also the 2 preceding calls which get a product and a collection fails with thoses errors

message: "Product access denied"
message: "Collection access denied"

 

So it definitely seems like a scope issue.

but what i am not getting is:

  1. it is not happening to everyone only a few merchant
  2. when checking the scopes for the failing merchant they seems fine
Replies 0 (0)