Shopify / shopify-api-ruby

ShopifyAPI is a lightweight gem for accessing the Shopify admin REST and GraphQL web services.
MIT License
1.06k stars 473 forks source link

No passed or active session (ShopifyAPI::Errors::NoActiveSessionError) #1224

Closed sajjadmurtaza closed 1 year ago

sajjadmurtaza commented 1 year ago

Issue summary

I setup new project and added gem 'shopify_api', '~> 13.1.0'

Here is my initializers/shopify_api.rb

ShopifyAPI::Context.setup(
  api_key: ENV['SHOPIFY_API_KEY'],
  api_secret_key: ENV['SHOPIFY_SECRET_KEY'],
  host: ENV['SHOPIFY_SHOP_NAME'],
  scope: 'read_products,write_products,read_orders,write_orders',
  is_embedded: false,
  api_version: ENV['SHOPIFY_API_VERSION'],
  is_private: true
)

When i run on rails console(to make sure if i can call shopify object):

ShopifyAPI::Product.all /Users/username/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/shopify_api-13.1.0/lib/shopify_api/clients/http_client.rb:14:in `initialize': No passed or active session (ShopifyAPI::Errors::NoActiveSessionError)

No passed or active session (ShopifyAPI::Errors::NoActiveSessionError)


lib/shopify_api/clients/http_client.rb:14:in `initialize': No passed or active session (ShopifyAPI::Errors::NoActiveSessionError)```

## Expected behavior

Should connect and return the products 

## Actual behavior

returning error:  NoActiveSessionError
ziaulrehman40 commented 1 year ago

What was the issue?

glenjamin commented 5 months ago

I just ran into this and found the answer in https://github.com/Shopify/shopify-api-ruby/blob/a64f7dd391306033ca58399b42fa32207ba6dc34/docs/usage/custom_apps.md