gatsbyjs / wp-gatsby

WordPress plugin for gatsby-source-wordpress
Other
167 stars 41 forks source link

GatsbyJS Wordpress plugin trigger not working with gatsby cloud build doesn't triggers on post or page update #187

Open creador-dev opened 3 years ago

creador-dev commented 3 years ago

GatsbyJS WordPress plugin trigger not working with gatsby cloud build doesn't trigger on post or page update

How to debug the issue? Any suggestion on how to fix this issue. I have tried the Jamstack delay plugin also

UPDATE:

I tried to trigger using Netlify Deploy Plugin (NetlifyPress) and it's working

Only manually triggering builds are working even with Netlify Press no automatic build is working does anyone know what is the issue with WordPress?

PawelBaranowski commented 3 years ago

I'm facing the same issue (webhook not getting triggered after post update) but my setup is different. I'm using a self-hosted WordPress instance on Docker. I'm trying to use a custom hook to trigger a CI build. So far I've ensured that:

WP: 5.8 WP Gatsby: 1.1.0 WP GraphQL: 1.6.4

Any help is appreciated.

creador-dev commented 3 years ago

Yes even I have configured it using WPGatsbyJS and even I am hosting it on Hostgator Shared Hosting Can you tell me how to check whether a POST request is sending or not??

PawelBaranowski commented 3 years ago

Can you tell me how to check whether a POST request is sending or not??

I don't know, unfortunately. I'm not a PHP guy. But my tests haven't found any traces of requests being sent.

PawelBaranowski commented 3 years ago

To be able to look deeper into this I installed Query Monitor plugin and used its logging functionality. I added do_action( 'qm/debug', 'debug' ); at the top of ActionMonitor::schedule_dispatch and ActionMonitor::trigger_dispatch. Neither gets called upon post's content update, nothing is logged in QueryMonitor.

This wasn't going to work (I guess QM logging cannot resurface from shutdown hook?). Anyway, I resorted to error_log and can confirm that trigger_dispatch actually gets called. After wrapping wp_safe_remote_post(...) in error_log(json_encode(...)) I can finally see http_request_failed and a message stating the URL is invalid. It's perfectly valid though, I need to solve that puzzle now.

PawelBaranowski commented 3 years ago

So apparently wp_safe_remote_post refuses to send a request because hostname resolves to a 'private' IP address (mine starts with 10. as all our hosts do). How can I make this work?

There's gatsby_trigger_dispatch_args introduced in #23, but I don't know how to use it or if it's what I need.

creador-dev commented 3 years ago

UPDATE:

I tried to trigger using Netlify Deploy Plugin (NetlifyPress) and it's working

Only manually triggering builds are working even with Netlify Press no automatic build is working does anyone know what is the issue with WordPress?

PawelBaranowski commented 3 years ago

I submitted #189 in order to allow hooks being called in private networks. @creador-dev can you check if this also fixes your issue?

creador-dev commented 3 years ago

I submitted #189 in order to allow hooks being called in private networks. @creador-dev can you check if this also fixes your issue?

No this doesn't solves my problem i am still facing same issue

ashhitch commented 3 years ago

@creador-dev did you get to the bottom of this? Also experiencing this issue. Wondering if it relates to Wordpress 5.8? As I have another site on the same server on 5.6 and that still works ok.

creador-dev commented 3 years ago

@creador-dev did you get to the bottom of this? Also experiencing this issue. Wondering if it relates to Wordpress 5.8? As I have another site on the same server on 5.6 and that still works ok.

I have just installed other plugin for manual trigger to trigger deploys. Everytime I have to do manual triggers whenever make changes.