简体   繁体   中英

storeUrl and password are not required .env issue

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

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
    },
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM