I have an issue using gatsby-source-shopify , i have inside the .env file :
GATSBY_STOREFRONT_ACCESS_TOKEN = xxxxx
GATSBY_SHOPIFY_STORE_URL= xxxxxx.myshopify.com/
SHOPIFY_SHOP_PASSWORD= xxx
gatsby-config.js:
require("dotenv").config()
module.exports = {
siteMetadata: {
siteTitle: "xxxx",
siteTitleDefault: "xxxx",
siteUrl: "xxxxxxx.myshopify.com/",
hrefLang: "en",
},
flags: {
FAST_DEV: true,
},
plugins: [
{ resolve: "gatsby-source-shopify",
options: {
password: process.env.SHOPIFY_APP_PASSWORD,
storeUrl: process.env.GATSBY_MYSHOPIFY_URL,
// salesChannel: process.env.SHOPIFY_APP_ID, // Optional but recommended
},
},
]
eventually when i run gatsby develop
i get this issue :
Invalid plugin options for "gatsby-source-shopify":
- "storeUrl" is required
- "password" is required
not finished load plugins - 0.807s it's like .env is not working properly
CodePudding user response:
Check your variable names, the names in the .env and the names in the code don't actually match. You could update the code to:
{ resolve: "gatsby-source-shopify",
options: {
password: process.env.SHOPIFY_SHOP_PASSWORD,
storeUrl: process.env.GATSBY_SHOPIFY_STORE_URL,
// salesChannel: process.env.SHOPIFY_APP_ID, // Optional but recommended
},
}