Open hicreate opened 4 years ago
Solved - not an issue with this package.
Had the same issue when trying to deploy to Google Cloud Functions, figured when the environmental variables were being brought in they weren't a valid string so I used a template literal to fix it:
exports.wooCommerce = new WooCommerceRestApi({
url: `${process.env.WOOCOMMERCE_URL}`,
consumerKey: `${process.env.WOOCOMMERCE_KEY}`,
consumerSecret: `${process.env.WOOCOMMERCE_SECRET}`,
version: "wc/v3",
axiosConfig: {
httpsAgent: new https.Agent({ rejectUnauthorized: false }),
},
});
I've noticed that using .env files makes the package throw an exception.
I'm setup in an express server, loading env via dotenv. Woo wrapper is working perfectly when I state my URL, key & secret but as soon as I load them into my server via process.env.API_URL or similar then I get an exception, starting with
"URL is required"