Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
creador-dev opened this issue Aug 26, 2021 · 10 comments

Comments

@creador-dev
Copy link

creador-dev commented Aug 26, 2021

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

  • using latest gatsby-source-wordpress
  • Even CMS Preview not working in WordPress

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
Copy link

PawelBaranowski commented Aug 26, 2021

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:

  • CI server is triggering a build after receiving a POST to request to the webhook's URL
  • The webhook's URL is properly configured in 'Builds Webhook URL' field in GatsbyJS settings page in WordPress
  • The webhook's URL is reachable from inside the container that's running WordPress
  • WordPress changes are recorder by Action Monitor
    I've also tried running an ad-hoc http listsner in the same docker-compose project and couldn't see any requests after modifying post's content.

WP: 5.8
WP Gatsby: 1.1.0
WP GraphQL: 1.6.4

Any help is appreciated.

@creador-dev
Copy link
Author

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
Copy link

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
Copy link

PawelBaranowski commented Aug 26, 2021

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
Copy link

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
Copy link
Author

creador-dev commented Aug 27, 2021

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
Copy link

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
Copy link
Author

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
Copy link

ashhitch commented Oct 5, 2021

@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
Copy link
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants