I am getting the following error during npm run develop:
gatsby-source-shopify/<shop-name> starting to fetch data from Shopify
error
error an error occured while sourcing data
error -
message: access denied
locations:
-
line: 4
column: 7
path:
- shop
- blogs
error query:
"""
query GetBlogs($first: Int!, $after: String) {
shop {
blogs(first: $first, after: $after) {
pageInfo {
hasNextPage
}
edges {
cursor
node {
id
title
url
}
}
}
}
}
"""
variables:
first: 250
after: null
Create a Storefront API Access Token that doesn't have access to "Read content like articles, blogs, and comments" and try to run gatsby
Site builds with only the queries I provide and successfully builds.
Unknown query is running and erroring. No where in my site am I running this query so I wouldn't expect it to run. My site doesn't need blogs from Shopify. The error is expected, the fact that it is running is not.
System:
OS: Linux 4.15 Ubuntu 18.04.1 LTS (Bionic Beaver)
CPU: (8) x64 AMD EPYC 3251 8-Core Processor
Shell: 4.4.19 - /bin/bash
Binaries:
Node: 12.2.0 - ~/.nvm/versions/node/v12.2.0/bin/node
npm: 6.9.0 - ~/.nvm/versions/node/v12.2.0/bin/npm
npmPackages:
gatsby: ^2.9.4 => 2.9.4
gatsby-image: ^2.1.4 => 2.1.4
gatsby-plugin-manifest: ^2.1.1 => 2.1.1
gatsby-plugin-offline: ^2.1.3 => 2.1.3
gatsby-plugin-react-helmet: ^3.0.12 => 3.0.12
gatsby-plugin-sharp: ^2.1.5 => 2.1.5
gatsby-source-filesystem: ^2.0.39 => 2.0.39
gatsby-source-graphql: ^2.0.19 => 2.0.19
gatsby-source-shopify: ^2.0.32 => 2.0.32
gatsby-transformer-sharp: ^2.1.21 => 2.1.21
npmGlobalPackages:
gatsby-cli: 2.6.7
gatsby-source-shopify doesn't currently have any way to limit what it queries for, so your token should have rights to access everything that it's trying to fetch.
It's possible to add this as configuration to gatsby-source-shopify, it could be something like:
fetchCollections: [`ARTICLES`, `BLOGS`, `PRODUCTS`]
We'd love a PR with this feature, I wonder if you would be interested in doing it :)
Thank you for using Gatsby! :purple_heart: :muscle:
Thanks for the reply but I鈥檓 curious, why is the plugin fetching anything? Isn鈥檛 it just a data access plugin that lets me make queries? Why does it need blog posts if I never make a query for blog posts?
@altano Gatsby source plugins generally fetch all available data. We can't know what data is needed, because the data might become required due to some transformer plugins in later stages.
gatsby-source-shopifydoesn't currently have any way to limit what it queries for, so your token should have rights to access everything that it's trying to fetch.It's possible to add this as configuration to
gatsby-source-shopify, it could be something like:fetchCollections: [`ARTICLES`, `BLOGS`, `PRODUCTS`]We'd love a PR with this feature, I wonder if you would be interested in doing it :)
Thank you for using Gatsby! 馃挏 馃挭
@freiksenet I did it a try!
Would you mind reviewing this PR ?
Thanks in advance
@martingtheodo Thank you for this PR! Let's continue talking there, I'll be closing this issue.
Fix published in [email protected] thanks to @martingtheodo