esbanarango/zapier-REST-hooks

404 error for /hooks path

zstrad44 opened this issue · 2 comments

I followed the installation steps and set up my triggers, but when I test the hooks#create endpoint I get a "No route matches [POST] /hooks" error. I tested this locally with postman and also within zapier, and I get the 404 error each time.

mount ZapierRestHooks::Engine, at: "/hooks" is in my routes.rb file.

Also, the route does appear when I run rake routes | grep hooks

zapier_rest_hooks            /hooks                                ZapierRestHooks::Engine
                           
 hooks POST   /hooks(.:format)     zapier_rest_hooks/hooks#create
  hook DELETE /hooks/:id(.:format) zapier_rest_hooks/hooks#destroy

Do I need to create a zapier hooks controller for the hooks#create path?

I am using the master branch of this gem and my app is running rails 5.1.4, and ruby 2.4.2

Let me know if you need additional context.

Hi @zstrad44, I've ran into the same issue.

Here's the solution:
When you have an engine that has /hooks route, and mount it at /hooks path, the actual URL for the controller action is /hooks/hooks.

I've made it all work through /hooks url, just by changing the mounting of the engine in routes.rb to mount ZapierRestHooks::Engine, at: '/'.

Hope that helps!

@zstrad44 let me know if @t-zubyak suggestion works for you! 🙏 And thank you @t-zubyak