Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 没有与[POST]匹配的路线”/webhooks/订单/完成”;ShopifRails_Ruby On Rails_Shopify_Webhooks - Fatal编程技术网

Ruby on rails 没有与[POST]匹配的路线”/webhooks/订单/完成”;ShopifRails

Ruby on rails 没有与[POST]匹配的路线”/webhooks/订单/完成”;ShopifRails,ruby-on-rails,shopify,webhooks,Ruby On Rails,Shopify,Webhooks,我使用shopify CLI创建shopify Rails应用程序,我想集成一个webhook,这是我的配置: config/initializers/shopify_app.rb ShopifyApp.configure do |config| config.application_name = "My Shopify App" config.api_key = ENV['SHOPIFY_API_KEY'] config.secret = ENV['SHOPIF

我使用shopify CLI创建shopify Rails应用程序,我想集成一个webhook,这是我的配置:

config/initializers/shopify_app.rb

ShopifyApp.configure do |config|
  config.application_name = "My Shopify App"
  config.api_key = ENV['SHOPIFY_API_KEY']
  config.secret = ENV['SHOPIFY_API_SECRET']
  config.old_secret = ""
  config.scope = ENV['SCOPES'] # Consult this page for more scope options:
                                 # https://help.shopify.com/en/api/getting-started/authentication/oauth/scopes
  config.embedded_app = true
  config.after_authenticate_job = false
  config.api_version = "2020-10"
  config.shop_session_repository = 'Shop'
  config.allow_jwt_authentication = true
  config.webhooks = [
    {topic: 'orders/fulfilled', address: 'https://4d132e9604.ngrok.io/webhooks/orders/fulfilled', format: 'json'},
  ]
end
config/routes.rb

Rails.application.routes.draw do
  root :to => 'home#index'
  mount ShopifyApp::Engine, at: '/'
  # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
end
app/jobs/completed_job.rb

class FulfilledJob < ActiveJob::Base
  def perform(shop_domain:, webhook:)
    shop = Shop.find_by(shopify_domain: shop_domain)

    puts "called hook!!!!"
    if shop.nil?
      logger.error("#{self.class} failed: cannot find shop with domain '#{shop_domain}'")
      return
    end

    puts "before shop"

    shop.with_shopify_session do
      puts "in shop with_shopify_session"
    end
  end
end
有什么想法吗?也许我忘了一些配置

Started POST "/webhooks/orders/fulfilled" for 127.0.0.1 at 2020-11-09 12:18:26 -0500

ActionController::RoutingError (No route matches [POST] "/webhooks/orders/fulfilled"):

actionpack (6.0.3.4) lib/action_dispatch/middleware/debug_exceptions.rb:36:in `call'
web-console (4.1.0) lib/web_console/middleware.rb:132:in `call_app'
web-console (4.1.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (4.1.0) lib/web_console/middleware.rb:17:in `catch'
web-console (4.1.0) lib/web_console/middleware.rb:17:in `call'
actionpack (6.0.3.4) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
railties (6.0.3.4) lib/rails/rack/logger.rb:37:in `call_app'
railties (6.0.3.4) lib/rails/rack/logger.rb:26:in `block in call'
activesupport (6.0.3.4) lib/active_support/tagged_logging.rb:80:in `block in tagged'
activesupport (6.0.3.4) lib/active_support/tagged_logging.rb:28:in `tagged'
activesupport (6.0.3.4) lib/active_support/tagged_logging.rb:80:in `tagged'
railties (6.0.3.4) lib/rails/rack/logger.rb:26:in `call'
sprockets-rails (3.2.2) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (6.0.3.4) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
actionpack (6.0.3.4) lib/action_dispatch/middleware/request_id.rb:27:in `call'
rack (2.2.3) lib/rack/method_override.rb:24:in `call'
shopify_app (15.0.0) lib/shopify_app/middleware/jwt_middleware.rb:23:in `call_next'
shopify_app (15.0.0) lib/shopify_app/middleware/jwt_middleware.rb:14:in `call'
shopify_app (15.0.0) lib/shopify_app/middleware/same_site_cookie_middleware.rb:11:in `call'
rack (2.2.3) lib/rack/runtime.rb:22:in `call'
activesupport (6.0.3.4) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (6.0.3.4) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (6.0.3.4) lib/action_dispatch/middleware/static.rb:126:in `call'
rack (2.2.3) lib/rack/sendfile.rb:110:in `call'
actionpack (6.0.3.4) lib/action_dispatch/middleware/host_authorization.rb:82:in `call'
webpacker (4.3.0) lib/webpacker/dev_server_proxy.rb:23:in `perform_request'
rack-proxy (0.6.5) lib/rack/proxy.rb:57:in `call'
railties (6.0.3.4) lib/rails/engine.rb:527:in `call'
puma (4.3.6) lib/puma/configuration.rb:228:in `call'
puma (4.3.6) lib/puma/server.rb:713:in `handle_request'
puma (4.3.6) lib/puma/server.rb:472:in `process_client'
puma (4.3.6) lib/puma/server.rb:328:in `block in run'
puma (4.3.6) lib/puma/thread_pool.rb:134:in `block in spawn_thread'