Troubleshooting
Before You Begin
This document is meant to aid when troubleshooting common issues that arise when
using the @pantheon-systems/next-wordpress-starter
. For additional
troubleshooting information related to the Pantheon platform, see
Pantheon Front-End Sites Frequently Asked Questions.
Images Are Not Working
Local Development:
- Check that the
IMAGE_DOMAIN
environment variable is set in the.env.development.local
file. - Ensure the
IMAGE_DOMAIN
environment only contains the hostname. For example:IMAGE_DOMAIN=example.com
- Ensure that you are using the
next/image
component and that you set the src by constructing theIMAGE_DOMAIN
and the image source. For example:jsx // in the starter kit, the IMAGE_URL is available // as a constant which is exported from lib/constants.js import { IMAGE_URL } from '../../lib/constants'; import Image from 'next/image'; const MyPage = (props) => { // ensure the sourceUrl is a relative path, not an absolute URL // because we will append this to the IMAGE_URL const sourceUrl = props.url; const altText = props.alt; return ( <> <Image src={IMAGE_URL + sourceUrl} alt={altText} // remaining Image props... /> </> ); };
See The docs on thenext/image
component for more information.
Trouble Fetching Data From WordPress
- Ensure the
WPGRAQPHQL_URL
environment variable is set and contains the correct endpoint - Ensure the
WP GraphQL
plugin is activated on WordPress
Decoupled Kit Health Check is Failing Valid Builds
Opt Out With an Environment Variable
To opt out of the health check, set the NO_DKHC
environment variable. If this
variable is set to anything, the health check will be skipped.
Unset the variable to continue running the health check before the build step.
Remove the Health Check
After you begin editing content in your WordPress CMS, you may find the
@pantheon-systems/decoupled-kit-health-check
unnecessary. If you would like to
remove it from the build step, follow the steps below:
- In a text editor, open the
package.json
- Find the
"scripts"
and remove"decoupled-kit-health-check": "npx --prefer-offline @pantheon-systems/decoupled-kit-health-check wordpress"
- Edit the
"build"
script and removenpm run decoupled-kit-health-check &&
from the beginning of the script - Find the
"devDependencies"
and remove@pantheon-systems/decoupled-kit-health-check
, Or in a terminal, runnpm rm @pantheon-systems/decoupled-kit-health-check