Skip to content
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

Shopify API did't work in rails console #1253

Closed
dummydummydev opened this issue Dec 7, 2023 · 3 comments
Closed

Shopify API did't work in rails console #1253

dummydummydev opened this issue Dec 7, 2023 · 3 comments

Comments

@dummydummydev
Copy link

Issue summary

I am working on rails + shopify App
I want to list my webhooks and update the url of webhooks
So I used REST API

  • shopify_api version: "13.3.1"
  • Ruby version: ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
  • Operating system: Ubuntu 20.04.6 LTS
  • shopify_app version: gem "shopify_app", "~> 21.7"
  • Node version : v20.9.0
  • npm version : 10.2.4
  • rails version : Rails 7.0.8
  • ShopifyApp.configuration.api_version: 2023-10
// Paste any relevant logs here
```ruby
# Webhook API
irb(main):009> test_session = ShopifyAPI::Auth::Session.new(shop: shop.shopify_domain, access_token: shop.shopify_token)
=> 
#<ShopifyAPI::Auth::Session:0x00007fe8d3b29b70
...
irb(main):010> ShopifyAPI::Webhook.all(session: test_session,api_version:'2023-10')
(irb):10:in `<main>': uninitialized constant ShopifyAPI::Webhook (NameError)

ShopifyAPI::Webhook.all(session: test_session,api_version:'2023-10')
          ^^^^^^^^^
Did you mean?  ShopifyAPI::Webhooks
irb(main):011> ShopifyAPI::Webhooks.all(session: test_session,api_version:'2023-10')
(irb):11:in `<main>': undefined method `all' for ShopifyAPI::Webhooks:Module (NoMethodError)

ShopifyAPI::Webhooks.all(session: test_session,api_version:'2023-10')
                    ^^^^
irb(main):012> 
# Product API
irb(main):015> test_session = ShopifyAPI::Auth::Session.new(shop: shop.shopify_domain, access_token: shop.shopify_token)
=> 
#<ShopifyAPI::Auth::Session:0x00007fe8d3a4d738
...
irb(main):016> ShopifyAPI::Product.count(session: test_session)
(irb):16:in `<main>': uninitialized constant ShopifyAPI::Product (NameError)

ShopifyAPI::Product.count(session: test_session)
          ^^^^^^^^^
Did you mean?  Proc
irb(main):017> ShopifyAPI::Product.all(session: test_session)
(irb):17:in `<main>': uninitialized constant ShopifyAPI::Product (NameError)

ShopifyAPI::Product.all(session: test_session)
          ^^^^^^^^^
Did you mean?  Proc
irb(main):018> 

irb(main):018> test_session = ShopifyAPI::Auth::Session.new(shop: shop.shopify_domain, access_token: shop.shopify_token)
=> 
#<ShopifyAPI::Auth::Session:0x00007fe8d9582f18
...
irb(main):019* ShopifyAPI::Order.all(
irb(main):020*   session: test_session,
irb(main):021*   status: "any",
irb(main):022> )
(irb):19:in `<main>': uninitialized constant ShopifyAPI::Order (NameError)

ShopifyAPI::Order.all(
          ^^^^^^^
irb(main):023> 

Expected behavior

All The API Should Call and must show results

Actual behavior

Each API Giving error

Steps to reproduce the problem

  1. make an App with Shopify ruby template (https://github.com/Shopify/shopify-app-template-ruby/)
  2. Open Rails Console and Test it
@matteodepalo
Copy link
Contributor

matteodepalo commented Dec 12, 2023

Hi @dummydummydev, could you give us more details to help us reproduce? It seems like ruby is failing to load the ShopifyAPI module, you might have to require it after you start the console.

Copy link

We are closing this issue because we did not hear back regarding additional details we needed to resolve this issue. If the issue persists and you are able to provide the missing clarification we need, feel free to respond and reopen this issue.

We appreciate your understanding as we try to manage our number of open issues.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 20, 2023
@sshaw
Copy link

sshaw commented Jan 12, 2024

You must do proper setup so Zeitwerk can load the constants for you. See #1263 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants