0

I have a website which I have developed using Gatsby. I have used WordPress for posting blogs for website and I'm fetching blogs using GraphQL. Everything is working fine, and I deployed the website on S3. After production deployment, when I published a new blog in WordPress, it is not being listed in the website using GraphQL. I had to re-deploy the code to make it working.

Is there any other way to load WordPress GraphQL data in production without rebuild and re-deploy?

Ravi.K
  • 41
  • 1
  • 6

1 Answers1

0

What you described is normal behavior. Gatsby is a static site generator so your data is "static" in terms of what is being built at the moment you run gatsby build. If something in the source changes, like publishing a post, you need to rebuild the site to make them available by GraphQL, hence Gatsby.

What you want to achieve is called webhook: an action that triggers another action. Like when publishing a post, trigger a new deploy to force the publishing of that post in a production environment.

You can follow this article for a more approach that suits you.

If you are using Gatsby's v4, you can use the new SSR (Server-Side Rendering) brand feature to serve data from the server or DSG (Deferred Static Generation) for a combined approach, partially static, partially server-side served.

Ferran Buireu
  • 28,630
  • 6
  • 39
  • 67