Shopify-api-node: Context influences requests (Response code 401 (Unauthorized))
I am trying to create a public app.
When trying to create a product from inside my application it throws with : Response code 401 (Unauthorized)
However when I create a node script like this:
const Shopify = require('shopify-api-node')
const createProduct = async () => {
const shopify = new Shopify({
accessToken: ****,
shopName: ****,
apiVersion: '2020-04',
})
const res = await shopify.product.create({ title: 'Test' })
console.log(res)
}
createProduct()
the product gets created successfully.
I tried to paste the exact same code in my application, but I still get the 401.
My application is built apollo-server-micro and running as an api route from next.js
If you need more info, I am happy to provide.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16
@BjoernRave this is a dirty workaround but it should work if you are not using the proxy functionality. In the module where you require
auth0
for the first time doNot sure if it breaks the
auth0
module but it should not.Edit: I’m confident it does not break
auth0
if the proxy functionality is not used as per https://github.com/ngonzalvez/rest-facade/blob/v1.13.0/src/Client.js#L321-L323.Yes, I ran
npm ls agent-base
after installing the latest version ofauth0
and everything looks good. It should work without issues.I’m closing this as the issue has been fixed in
superagent-proxy@2.1.0
.