我无法使用香草 Rails + Turbolinks Shopify 应用程序

问题描述

我刚刚完成了 Rails & Turbolinks tutorial - 因为我是第一次创建 Shopify 应用程序。我到了我的应用程序正在加载的阶段,但我看到的只是“正在加载...”页面,即“SplashPage#Index”,但它没有像我期望的那样重定向到我的“Home#Index”。

我正在使用 Rails 6.0.3.6Ruby 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&timestamp=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 控制台的完整错误

full-error-from-JS-Console

解决方法

我终于明白了。即使我没有明确使用 NPM,我仍然需要将 public boolean shouldInvokeProcess() { return !validators.stream().anyMatch(ForbiddenChecker::isForbidden); } Both seem about equally fine,here,and trivial. 实用程序包含到我的 JS 包管道中。

我通过运行以下命令来做到这一点:

@shopify/app-bridge

它就像一个魅力,现在一切都很好。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...