NameError:非初始化的Constant Shopifapi :: Session Shopify_app Gem -V 19,Rails 7

发布于 2025-02-06 05:05:52 字数 421 浏览 3 评论 0原文

我正在使用背景作业通过Webhook获取订单并执行其他处理。我将其在我的后台作业上获取,但是当我尝试启动会话时,它会给我以下错误。

nameError:nameReror:niritialialized constant shopifyapi :: session 我正在使用以下版本: Rails:-7.0.3,Ruby:-3.1.2,Shopify_app:-19.0.2

有人可以向我解释一下我在这里做错了什么? GEM Update/最新版本是否具有在后台作业中激活或创建会话的不同方法。

非常感谢您的建议。

I am using background jobs to get orders via webhook and perform some other processing. I get the webhook it on my background jobs but when When I try to initiate a session it gives me the following error.

NameError: uninitialized constant ShopifyAPI::Session
I am using the following versions:
rails:- 7.0.3, ruby:- 3.1.2, shopify_app:- 19.0.2

can anyone explain it to me that what I am doing wrong here? Did the gem update/latest version has a different approach to activate or create a session in background job.

I really appreciate your suggestions.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

岁月染过的梦 2025-02-13 05:05:52

在Shopify Gems的新版本中,Shopifyapi :: Session不再存在:

https://www.rubydoc.info/gems/shopify_api/#breaking-change-change-change-notice-notice-for-version-10-0-0-0

您现在可以创建一种方法:

 # Public. Activate the Shopify API session for the currently authenticated shop.
 def invoke_shopify_api
    ShopifyAPI::Auth::Session.temp(shop: shopify_domain, access_token: shopify_token) do |session|
     # make invocations to the API
     yield
   end
 end

In the new version of the shopify gems, ShopifyAPI::Session doesn't exist anymore:

https://www.rubydoc.info/gems/shopify_api/#breaking-change-notice-for-version-10-0-0

now you can create a method:

 # Public. Activate the Shopify API session for the currently authenticated shop.
 def invoke_shopify_api
    ShopifyAPI::Auth::Session.temp(shop: shopify_domain, access_token: shopify_token) do |session|
     # make invocations to the API
     yield
   end
 end
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文