---
title: "Troubleshooting the Next.js Personalize add-on"
slug: "troubleshooting-the-next-js-personalize-add-on"
abstract: "Investigate issues with rendering personalized pages and missing or incorrect Page View event data"
---
# Troubleshooting the Next.js Personalize add-on

If personalized pages do not render as expected or [SitecoreAI Page builder Analyze](https://doc.sitecore.com/xmc/en/users/xm-cloud/en/page-insights-dashboard-in-analyze.html) does not show the data you were expecting to see, you must troubleshoot your implementation.

<details>
<summary><h2>Troubleshoot personalized page rendering issues</h2></summary>

If personalized pages do not render as expected, you can troubleshoot the Personalize middleware. The middleware has extensive debug trace logging that can prove helpful.

To troubleshoot the Personalize middleware:

1. Turn on [debug logging](https://doc.sitecore.com/sai/en/developers/jss/215/jss-sai/debug-logging-in-jss-apps.html "Debug logging in JSS apps") for the middleware by setting the `DEBUG` environment variable value to the Next.js Personalize add-on namespace. For example: `DEBUG=sitecore-jss:personalize`.
2. Verify that the following environment variables have the correct values:
    - `NEXT_PUBLIC_CDP_TARGET_URL`.
    - `NEXT_PUBLIC_CDP_CLIENT_KEY`.
    - `NEXT_PUBLIC_CDP_POINTOFSALE`.
3. If you notice requests to CDP or Edge time out, increase the timeout value by setting the `PERSONALIZE_MIDDLEWARE_CDP_TIMEOUT` and/or `PERSONALIZE_MIDDLEWARE_EDGE_TIMEOUT` environment variables to a value higher than the default 250 milliseconds.

</details>

<details>
<summary><h2>Troubleshoot Page View events</h2></summary>

If you do not see the expected data in SitecoreAI Page builder Analyze, you can troubleshoot the Page View events.

Page View events are triggered client-side.

To start troubleshooting Page View events:

1. In the browser, open the developer tools and check the console for any errors. Failing requests provide detailed error messages such as *client key is not valid*.
2. Verify that the following environment variables have the correct values:
    - `NEXT_PUBLIC_CDP_CLIENT_KEY`.
    - `NEXT_PUBLIC_CDP_POINTOFSALE`.

</details>