-
Notifications
You must be signed in to change notification settings - Fork 9
Debugging common errors with Next.js and Drupal integration
The content model of the basic starter is designed to work with Acquia CMS with its default content model. Installing Acquia CMS with the content model to ensures that the backend has all the content that the Next.js site uses.
If you prefer to install Acquia CMS without the default content model, or you want to modify the content model, you'll have to modify CONTENT_TYPES
in [...slug].tsx
to match the content model in the Acquia CMS backend.
Ensure that you have configured environment variables correctly. This can be tested by making a GET request to [NEXT_PUBLIC_DRUPAL_BASE_URL]/jsonapi
. To get the most accurate results, it is recommended to make a request from the container where the Next.js app is hosted to make sure that network connection and authentication more closely resemble the Next.js app. This could be done with curl -v [NEXT_PUBLIC_DRUPAL_BASE_URL]/jsonapi
for example.
If you are not getting a valid response, the error is caused by the backend. This could be either misconfigured Acquia CMS or misconfigured web server.
If you are using Laravel Valet as your environment, please see https://github.com/laravel/valet/issues/771#issuecomment-485533478 for a known solution.
If you are using Lando as your webserver, check your .env.local file and see if https is used as the protocol for NEXT_PUBLIC_DRUPAL_BASE_URL variable. It is a known issue where it seems on Lando setup, the Drupal URL generates with https even if it should use http as the protocol.
Next.js for Acquia CMS is using subrequests which is not compatible with PHP built-in webserver because it is running in a single thread.