Why is the Shopify API version causing errors in my Ruby program?

Topic summary

A previously working plain Ruby script (not Rails) now fails with “uninitialized constant ShopifyAPI::Base (NameError)” when executing ShopifyAPI::Base.api_version = “2021-01”. The failure started after updating dependencies.

Installing the latest shopify_api gem (10.1.0) triggered the error. Downgrading to shopify_api 9.4.1 restored functionality, pointing to a breaking change between these versions.

The author is looking for guidance or sample Ruby code compatible with the latest gem version. No migration steps or examples for 10.1.0 were provided in the thread.

Current outcome: pinning the gem to 9.4.1 is a working workaround. The question of how to adapt code to 10.1.0 remains open.

Summarized with AI on February 16. AI used: gpt-5.

Hello Everyone,

I’ve not used Shopify for the past few months. But today, I tried running my ruby programs that used to work, just a few months back, but now I’m getting error “uninitialized constant ShopifyAPI::Base (NameError)”.

The line that caused this error is this - ShopifyAPI::Base.api_version = “2021-01”

I’m just running a plain simple ruby program, not Rails.

Any idea what has changed recently to cause that line of code to fail?

Any advice will be greatly appreciated.

Thanks!

1 Like

I think I figured it out. When I ran “gem install shopify_api”, the latest version which is 10.1.0 was installed. I uninstalled this version and reinstalled using this command “gen install shopify_api -v 9.4.1”. This time around, my code is working again.

Any guide or sample ruby code using the latest version will be very much appreciated.

Thanks!