rake routes
this is my routes file
but when I make request '/', I got error
F, [2020-02-12T04:57:06.400949 #21830] FATAL -- : [eac71eea-131f-4edc-8c7f-7681d02c6824] ActionController::RoutingError (No route matches [GET] "/"):
it's working in my local.
I set :server_mode in secrets.yml, and It worked.
but, in production, it's not working.
I had to make routes in routes.rb not admin_routes.rb.
What should I do?
I'm getting an error when I start rails in development
ActionController::UrlGenerationError - No route matches {:action=>"index", :client_id=>"bd881667-ee11-441e-a98f-6f6a6005435a-53d08ea16f47a449a12861c8ebf6e1d3", :controller=>"reception"}
It seems to be coming from a link:
reception_index_url
rake routes shows
reception_index GET /reception(.:format) reception#index
so the route is there but I'm guessing :client_id is the problem. I have added mount HyperMesh::Engine => '/rr' to routes.rb
What am I missing?
I am using the ShopifyApp gem, which has an action called receive in its WebhooksController. As seen here: Webhooks controller
In my WebhooksController controller I am trying to override that receive action by doing the following:
class WebhooksController < ShopifyApp::WebhooksController
def receive
binding.pry
end
end
My route to my WebhooksController is this:
webhooks_receive POST /webhooks/receive(.:format) webhooks#receive
And the route put in by the Gem engine is:
webhooks POST /webhooks/:type(.:format) shopify_app/webhooks#receive
I see the data come in, but for some reason its not hitting my receive action and stopping at my pry and I'm not sure why.
Found this and tried it, but no luck.
I tried this solution too and it didn't work..
Any thoughts?
Here are the top of my logs showing what's happening:
Started POST "/webhooks/receive" for XX.XXX.37.116 at 2016-04-21 14:57:02
+0000
Cannot render console from XX.XXX.37.116! Allowed networks: XXX.0.0.1, ::1,
127.0.0.0/127.XXX.XXX.255
ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".*
FROM "schema_migrations"
Processing by ShopifyApp::WebhooksController#receive as */*
Parameters: {"rate"=>{"origin"=>{"country"=>"US", "postal_code"=>"48615",
"province"=>"MI", "city"=>"Breckenridge", "name"=>nil, "address1"=>"6760..
bunch of data removed for brevity}}}
Completed 500 Internal Server Error in 6ms (ActiveRecord: 0.0ms)
NoMethodError (undefined method `variable_size_secure_compare' for
ActiveSupport::SecurityUtils:Module):
shopify_app (7.0.2) lib/shopify_app/webhook_verification.rb:20:in
`hmac_valid?'
And my routes file
Rails.application.routes.draw do
root :to => 'home#index'
mount ShopifyApp::Engine, at: '/'
resources :store
resources :shipping_methods
post '/webhooks/receive', to: 'webhooks#receive'
post '/billing_plans', to: 'billing_plans#save_plan', as: 'save_plan'
get '/activate_charge', to: 'billing_plans#activate_charge', as: 'activate'
post '/create_charge', to: 'billing_plans#create_charge', as:
'create_billing_plan'
After two days of troubleshooting I realized their Gemspec was including an old version of rails that did not contain the method they were calling..
I let them know and bumped my version from 4.2.5 to 4.2.6 and now it works.. frustrating but solved.. thanks everyone for your support!
If anyone else comes across this, in order to use the Shopify App gem Webhooks controller you will need to be running Rails 4.2.6.
Try putting routes in this order:
post '/webhooks/receive', to: 'webhooks#receive'
mount ShopifyApp::Engine, at: '/'
Rails routes are matched in the order they are specified, so if you
have a resources :photos above a get 'photos/poll' the show action's
route for the resources line will be matched before the get line. To
fix this, move the get line above the resources line so that it is
matched first.
So in order for your own route to take precedence over the one that is defined in the ShopifyApp gem, you need to define it before mounting the ShopifyApp engine.
Moving your own route post '/webhooks/receive', to: 'webhooks#receive' before mount ShopifyApp::Engine, at: '/' should fix the issue.
Refer to Rails Routing from the Outside In for more info.
I am trying to port a working rails 2.4 app to rails 4.2. I cannot get the routing to work.
the URL of x.pdf is broken into id.format and passed as params to a report controller.
in Rails 2.4 I have
map.report ':id.:format', :controller => :reports, :action => :generate
in Rails 4.2 I am trying to use
get ':id.:format' => 'reports#generate'
but when i run the app and browse to http://www.example.com/x.pdf, i get the fatal error
ActionController::RoutingError (No route matches [GET] "/x"):
When I run rake routes I get:
Prefix Verb URI Pattern Controller#Action
GET /:id.:format reports#generate
I am using Ruby 2.3.0, Rails 4.2.5, NGINX 1.9.9, Passenger 5.0.23
Any help would be appreciated!
You should change get ':id.:format' to just get ':id'
I have a definition in routes.rb that is something like this:
namespace :admin do
resources :users do
resources :email_addresses, controller: 'email_addresses'
end
end
The two controllers that exist are Admin::UsersController and EmailAddressesController. The problem I'm seeing is that once I deploy the app to production, trying to access any of the links for the email addresses resource results in a 404 and an uninitialized constant error for Admin::EmailAddressesController. For whatever reason, this isn't happening in my development environment.
Here's the output from my production environment log:
Started GET "/admin/users/3/email_addresses/new" for 192.168.206.6 at 2013-08-21 10:00:43 -0700
ActionController::RoutingError (uninitialized constant Admin::EmailAddressesController):
Here it is in my development environment working just fine:
Started GET "/admin/users/1/email_addresses/new" for 127.0.0.1 at 2013-08-21 10:03:04 -0700
Processing by EmailAddressesController#new as JS
Strange, right?
Here is an example of the link that I'm using that results in an error (once clicked):
link_to "Add Email Address", new_admin_user_email_address_path(user)
UPDATE: It seems as though the issue may be related to the issue mentioned in this bug report: https://github.com/rails/rails/issues/5798 . Question is, how do I explicitly reference the non-namespaced controller in controller: ?