-
Notifications
You must be signed in to change notification settings - Fork 476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resources not loading when using session based auth #1263
Comments
Just had the same problem myself with 13.3.1 under Ruby 3.1 and 2.7. So many docs, but not a single way showing you how to require. Upon further investigation, it looks like this is intentional as they're using Zeitwerk! My my my what in tarnation have they done to this library! REST API call now require native library compilation and installing sorbet-runtime 😱🤯👎 |
@agbaber here is what you must do, in some form. This case assumes you're calling from an app but hopefully this will get you somewhere: ShopifyAPI::Context.setup(
:api_key => a,
:api_secret_key => b,
:api_version => "2023-07",
:is_private => false,
:scope => "your scopes",
:is_embedded => false
)
ShopifyAPI::Context.activate_session(
ShopifyAPI::Auth::Session.new(
:shop => shopify_domain,
:access_token => shopify_token,
)
)
ShopifyAPI::Product.find(id: id) zOMG |
Thanks @sshaw!
Yeah, it does seem intentional (and predicated on choosing an
Edit: Hmm, no I guess you do need both. Obnoxious that it's not obvious in the docs. Hilariously, all the doc examples use |
Hi folks 👋 Thank you for the feedback, I appreciate it, I am going to bring this up with the team. I definitely understand the confusion. |
hey folks, this results from a breaking change in v10 of this gem https://github.com/Shopify/shopify-api-ruby/blob/main/BREAKING_CHANGES_FOR_V10.md We're updating the doc to reflect that. |
Issue summary
When using session-based auth, admin API resources are not being autoloaded correctly. Note that this is the same issue as this one, which was auto-closed.
shopify_api
version: 13.3.1Expected behavior
The latest-versioned
Resources
should be autoloaded when an explicit version is not specified.Actual behavior
The gem does not load the
Resources
and returns anuninitialized constant
error.Steps to reproduce the problem
require 'shopify_api'
)ShopifyAPI::Auth::Session.new
ShopifyAPI::Product.all(session: session)
)The text was updated successfully, but these errors were encountered: