我已发送应用程序(尚未列出)以供审核。审阅者在 HomeController 的索引操作上收到上述错误,当用户单击安装按钮时触发。我在不同合作伙伴帐户中的许多开发商店验证了该应用程序。我能够为我测试的所有商店成功安装该应用程序。
这是代码的简化版本
控制器/shopify/home_controller.rb
module Shopify
class HomeController < ShopifyApp::AuthenticatedController
def index
MyCustomServie.new(shopify_detail).call
end
private
def current_shopify_store
@current_shop ||= begin
Shopify::Base.with_rate_limit_protection do
ShopifyAPI::Shop.current
end
end
end
def shopify_detail
@shopify_detail ||= ShopifyDetail.find_by(shopify_domain: current_shopify_store.try(:myshopify_domain))
end
end
end
配置/初始化程序/omniauth.rb
Rails.application.config.middleware.use OmniAuth::Builder do
provider :shopify,
ShopifyApp.configuration.api_key,
ShopifyApp.configuration.secret,
scope: ShopifyApp.configuration.scope,
callback_path: "#{Settings.shopify.mounted_at}/auth/shopify/callback"
provider :google_oauth2,
Settings.google.client_id,
Settings.google.client_secret,
{ access_type: "offline", approval_prompt: "" }
end
配置/初始化程序/shopify_app.rb
ShopifyApp.configure do |config|
config.application_name = 'Shopify - Feed Champion'
config.api_key = Settings.shopify.api_key
config.secret = Settings.shopify.api_secret
config.scope = Settings.shopify.scope
config.embedded_app = true
config.after_authenticate_job = { job: ShopifyAfterAuthenticateJob, inline: true }
config.webhooks = [ Shopify::AppUninstalledWebhook::PARAMS ]
end
错误来自以下行
ShopifyAPI::Shop.current
这是错误日志。任何人都可以指点可能出问题的地方吗?