Shopify_app: undefined method `storage' for ShopifyApp::SessionRepository:Class

Created on 26 Mar 2020  路  2Comments  路  Source: Shopify/shopify_app

I updated shopify_app gem to the latest version(13.0.0) and while starting the server I got this error
undefined methodstorage=' for ShopifyApp::SessionRepository:Class (NoMethodError)
Did you mean? shop_storage= `

I have a initializer called shopify_session_repository.rb

if Rails.configuration.cache_classes
  ShopifyApp::SessionRepository.storage = Shop
else
  reloader = defined?(ActiveSupport::Reloader) ? ActiveSupport::Reloader : ActionDispatch::Reloader

  reloader.to_prepare do
    ShopifyApp::SessionRepository.storage = Shop
  end
end

This is the one throwing the error.

I tried using ShopifyApp::SessionRepository.shop_storage = Shop

And got this error:
* ArgumentError Exception: shop storage must respond to :store and :retrieve
But, I have include ShopifyApp::SessionStorage in my Shop model

Could you please help me with this!

Most helpful comment

You should be able to get rid of your custom initializer in your app. Now you can just add

ShopifyApp.configure do |config|
  config.shop_session_repository = 'Shop'
end

And also make sure to change include ShopifyApp::SessionStorage to include ShopifyApp::ShopSessionStorage in your Shop model.

There is a migration guide in the README for 13.0.0 https://github.com/Shopify/shopify_app#migrating-to-1300

All 2 comments

You should be able to get rid of your custom initializer in your app. Now you can just add

ShopifyApp.configure do |config|
  config.shop_session_repository = 'Shop'
end

And also make sure to change include ShopifyApp::SessionStorage to include ShopifyApp::ShopSessionStorage in your Shop model.

There is a migration guide in the README for 13.0.0 https://github.com/Shopify/shopify_app#migrating-to-1300

Thank you so much, worked like a charm!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

resistorsoftware picture resistorsoftware  路  8Comments

quocble picture quocble  路  8Comments

jakeyeaton16 picture jakeyeaton16  路  6Comments

MisinformedDNA picture MisinformedDNA  路  6Comments

orenmazor picture orenmazor  路  9Comments