Ecommerce Shopify WordPress Discussion

Gatsby ENABLE_GATSBY_REFRESH_ENDPOINT not working as intended

I am building with Gatsby for the frontend and wordpress for headless CMS. when I make a change on my wordpress post, i want the change to reflect in my gatsby page instantly. however, when i make a change, i have to stop and restart the server for the changes to reflect. I have looked through gatsby documentation and added "ENABLE_GATSBY_REFRESH_ENDPOINT" to my env file but it is not working. What am i doing wrongly? Here is the content in my .env at the root of my project directory ENABLE_GATSBY_REFRESH_ENDPOINT=true here is my gatsby-config file import type { GatsbyConfig } from 'gatsby' import * as dotenv from 'dotenv' // see https://github.com/motdotla/dotenv#how-do-i-use-dotenv-with-import dotenv.config() const config: GatsbyConfig = { siteMetadata: { title: meta.title, description: meta.description, siteUrl: meta.siteUrl, logo: meta.logo, }, // More easily incorporate content into your pages through automatic TypeScript type generation and better GraphQL IntelliSense. // If you use VSCode you can also use the GraphQL plugin // Learn more at: https://gatsby.dev/graphql-typegen graphqlTypegen: true, plugins: [ 'gatsby-plugin-postcss', 'gatsby-plugin-image', 'gatsby-plugin-sitemap', { resolve: 'gatsby-source-wordpress', options: { url: // allows a fallback url if WPGRAPHQL_URL is not set in the env, this may be a local or remote WP instance. `http://url/graphql`, schema: { //Prefixes all WP Types with "Wp" so "Post and allPost" become "WpPost and allWpPost". typePrefix: `Wp`, timeout: 3000000, }, develop: { //caches media files outside of Gatsby's default cache an thus allows them to persist through a cache reset. hardCacheMediaFiles: true, }, type: { Post: { limit: process.env.NODE_ENV === `development` ? // Lets just pull 50 posts in development to make it easy on ourselves (aka. faster). 50 : // and we don't actually need more than 5000 in production for this particular site 5000, }, Page: { limit: 0, }, MenuItem: { limit: 0, }, User: { limit: 0, }, Tag: { limit: 0, }, }, }, }, { resolve: 'gatsby-plugin-manifest', options: { icon: 'src/images/logo.png', }, }, 'gatsby-plugin-sharp', { resolve: 'gatsby-plugin-sitemap', options: { exclude: ['/thankyou'], }, }, 'gatsby-transformer-sharp', { resolve: 'gatsby-source-filesystem', options: { name: 'images', path: './src/images/', }, __key: 'images', }, 'gatsby-plugin-react-svg', { resolve: 'gatsby-plugin-manifest', options: { name: meta.title, short_name: meta.title, start_url: '/', background_color: 'white', theme_color: '#101C45', display: 'standalone', lang: 'en', icon: 'static/logo.png', description: meta.description, }, }, ], } export default config
By setting ENABLE_GATSBY_REFRESH_ENDPOINT to true in your environment you are enabling a webhook which can be triggered to refresh your site. To test this out, run a local development version of the site, setting the environment variable. Then trigger a refresh by hitting the webhook: curl -X POST http://localhost:8000/__refresh You should see that pages are rebuilt. More details about this can be found here. Now you need to set up a trigger on your Wordpress site which will hit the corresponding webhook on your deployed Gatsby site. See this for details on how this would be done.

January 7, 2024

TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.