如何解决我无法使用香草 Rails + Turbolinks Shopify 应用程序
我刚刚完成了 Rails & Turbolinks tutorial - 因为我是第一次创建 Shopify 应用程序。我到了我的应用程序正在加载的阶段,但我看到的只是“正在加载...”页面,即“SplashPage#Index”,但它没有像我期望的那样重定向到我的“Home#Index”。
我正在使用 Rails 6.0.3.6
、Ruby 3.0.1
而我没有使用 React。如果可能,我只想使用 Rails 和 Turbolinks 来构建我的应用程序,这就是我选择该教程的原因。
这是服务器日志(注意,出于隐私目的,我将 IP 地址清空了)。
Started GET "/?hmac=5e2e8c366d75e39831b775be635e4118a99c&host=bWFueS1wcmXlzaG9waWZ5LmNvbS9hZG1pbg&locale=en&new_design_language=true&session=7deccadd83c28b82dd4dd2902fff5c76573f365f637c2a&shop=random-shop.myshopify.com×tamp=1619310003" for 69.160.XXX.XX at 2021-04-24 19:20:04 -0500
┃ Cannot render console from 69.160.XXX.XX! Allowed networks: 127.0.0.0/127.255.255.255,::1
┃ Processing by SplashPageController#index as HTML
┃ Parameters: {"hmac"=>"5e2e8c366d75e39831b775be635e4118a99c","host"=>"bWFueS1wcmXlzaG9waWZ5LmNvbS9hZG1pbg","locale"=>"en","new_design_language"=>"true","session"=>"7deccadd83c28b82dd4dd2902fff5c76573f365f637c2a","shop"=>"random-shop.myshopify.com","timestamp"=>"1619310003"}
┃ Shop Load (1.8ms) SELECT "shops".* FROM "shops" WHERE "shops"."shopify_domain" = $1 LIMIT $2 [["shopify_domain","random-shop.myshopify.com"],["LIMIT",1]]
┃ CACHE Shop Load (0.2ms) SELECT "shops".* FROM "shops" WHERE "shops"."shopify_domain" = $1 LIMIT $2 [["shopify_domain",1]]
┃ Rendering splash_page/index.html.erb within layouts/embedded_app
┃ Rendered splash_page/index.html.erb within layouts/embedded_app (Duration: 0.1ms | Allocations: 6)
┃ [Webpacker] Everything's up-to-date. nothing to do
┃ Rendered layouts/_flash_messages.html.erb (Duration: 0.6ms | Allocations: 76)
┃ Completed 200 OK in 38ms (Views: 24.5ms | ActiveRecord: 2.3ms | Allocations: 8450)
可能导致这种行为的原因是什么,我该如何解决?
编辑 1
不确定这是否与任何事情有关,但是从我的 rails console
来看,当我执行 ShopifyApp.configuration.api_key
时,我得到了 nil
的回报。
编辑 2
当我检查我的 JS 控制台时,我看到以下错误:
Uncaught Error: Cannot find module '@shopify/app-bridge-utils'
但在我的 app/javascript/packs/application.js
中,我包含了以下内容:
require("shopify_app")
编辑 3
以下是来自 JS 控制台的完整错误:
解决方法
我终于明白了。即使我没有明确使用 NPM,我仍然需要将 public boolean shouldInvokeProcess() {
return !validators.stream().anyMatch(ForbiddenChecker::isForbidden);
}
Both seem about equally fine,here,and trivial.
实用程序包含到我的 JS 包管道中。
我通过运行以下命令来做到这一点:
@shopify/app-bridge
它就像一个魅力,现在一切都很好。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。