Access a community of over 900,000 Shopify Merchants and Partners and engage in meaningful conversations with your peers.
I'm trying to log in with oauth and I continually get a `UninitializedContextError.ShopifyError` with a stack trace like this:
Error: Context has not been properly initialized. Please call the .initialize() method to setup your app context object.
at UninitializedContextError.ShopifyError [as constructor] (/Users/weeksie/Workspace/melty/melty-questions/node_modules/@shopify/koa-shopify-auth/node_modules/@shopify/shopify-api/dist/error.js:13:28)
at new UninitializedContextError (/Users/weeksie/Workspace/melty/melty-questions/node_modules/@shopify/koa-shopify-auth/node_modules/@shopify/shopify-api/dist/error.js:63:42)
at Object.throwIfUninitialized (/Users/weeksie/Workspace/melty/melty-questions/node_modules/@shopify/koa-shopify-auth/node_modules/@shopify/shopify-api/dist/context.js:62:19)
That would be all well and good and clear if shopify-koa-auth was using the same shopify api as I am, but it doesn't appear to be. The version it's using is nested under the package's `node_modules`, which is why the "global" Shopify.Context that I'm initializing in my sever config doesn't seem to matter. Is this a known issue? what's a good workaround?
k, I think I found it. I was using `@shopify/shopify-api` version `1.2.0` and `@shopify/koa-shopify-auth` uses `1.1.0` so it was silently importing the wrong package.
Might be worth documenting somewhere.
I had the same error while trying to deploy my app on Heroku.
The error looked like this:
Error: Context has not been properly initialized. Please call the .initialize() method to setup your app context object.
at UninitializedContextError.ShopifyError [as constructor] (/app/node_modules/@shopify/koa-shopify-auth/node_modules/@shopify/shopify-api/dist/error.js:13:28)
The problem was related to the one above: We updated some of our packages, but the Heroku build was still using some of the old versions that were cached.
So there was a mismatch between the version of shopify-api that we thought we were using and the version that was actually built against in Heroku.
To solve our issue:
npm uninstall @Shopify/shopify-api
npm uninstall @Shopify/koa-shopify-auth
npm install --save @Shopify/koa-shopify-auth
Public Apps | Theme customization & App development
- Was my reply useful? Like it to let me know!
- Did I answer your question? Please mark as Accepted Solution.
- Need more help? Contact us.
@Shopify/koa-shopify-auth includes @Shopify/shopify-api as a dependency, so as long as you use the former you do not need to include @Shopify/shopify-api as a dependency in your package.json.
Had this issue happen to me as well and it's due to the two conflicting.
incase you are available i need help in connection with shopify admin api
Thank you, that worked perfectly for me. All letters, however, should be written in lowercase.
npm uninstall shopify/shopify-api
npm uninstall shopify/koa-shopify-auth
npm install --save shopify/koa-shopify-auth
Use @ symbol before every commend (@shopify/shopify-api).
User | RANK |
---|---|
6 | |
5 | |
3 | |
3 | |
3 |