Skip to content

AccessDenied on production, but not development #1415

@danielfriis

Description

@danielfriis

I'm running this query:

query = <<~QUERY
      query {
        shopifyqlQuery(query: "FROM sessions SHOW sessions, pageviews TIMESERIES day WITH TOTALS, CURRENCY 'DKK' SINCE -1m UNTIL today ORDER BY day ASC VISUALIZE sessions") {
          tableData {
            columns {
              name
              dataType
              displayName
            }
            rows
          }
          parseErrors
        }
      }
    QUERY

to get sessions and page_views

My application-wide api version is set to 2025-07, but for this query I set the Shopify session like this:

ShopifyAPI::Clients::Graphql::Admin.new(
      session: shopify_session,
      api_version: "2025-10"
    )

and run the query: shopify_client.query(query: query)

The app has the read_reports access scope.

It works in development, but in production, I get: Access denied for shopifyqlQuery field. Required access: "read_reports" access scope.

It seems that the access scope should be set:

shop.access_scopes
=> "read_products,read_reports,write_themes"

Any idea why this would work in development but not production?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions