---
schema_version: "1"
id: 2b74fb332676fb4851b24c9d1ea365d4a92265575ef3c6992ce1db141949fa93
title: Troubleshoot Common Storefront Preview Errors
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/commerce-cloud/pwa-kit-managed-runtime/guides/storefront-preview-troubleshoot.md
canonical_url: https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/storefront-preview-troubleshoot.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 5dd9b17594677a83b757a8a85c791cf68d5f2042bac1d9e68e8f56708b1434a4
products:
  - Composable Storefront
  - Salesforce APIs
---
# Troubleshoot Common Storefront Preview Errors

This section provides suggested solutions for common errors that you might encounter while using Storefront Preview.

## Third-party cookies aren't enabled

Depending on your browser, you may encounter different behavior when third-party cookies aren't enabled.

- **Chrome:** A modal appears stating "Preview is not enabled on this storefront", and the storefront displays a `SecurityError`.
- **Safari:** A modal appears stating "Failed to initialize Storefront Preview", and the storefront isn't visible.

**Cause:** Your browser doesn't allow third-party cookies on `https://runtime.commercecloud.com`.

**Suggested Solution:** Update your browser settings and any extensions you may use to allow third-party cookies on `https://runtime.commercecloud.com`.

## Storefront is missing the script that enables the communication layer

Error message when loading Storefront Preview: `"Preview is not enabled on this storefront!"`

**Cause:** The storefront is missing the script file that enables communication with Runtime Admin.

**Suggested Solution:** Follow the instructions shown in the error message window or complete the configurations in [Step 4](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/storefront-preview.md#4-add-the-storefrontpreview-component-to-your-storefront#4-add-the-storefrontpreview-component-to-your-storefront).

## MRT environment is missing required environment variables

Response error message when clicking the **Preview** button:

```html
400 error: Missing required environment variables:
CC_SHORT_CODE,SLAS_PRIVATE_CLIENT_ID,SLAS_PRIVATE_CLIENT_SECRET
```

**Suggested Solution:** Complete the configurations in [Step 1](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/storefront-preview.md#1-create-a-slas-private-client-for-your-b2c-commerce-instances) and [Step 2](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/storefront-preview.md#2-create-mrt-environment-variables-with-the-slas-private-client-details-and-the-commerce-api-short-code).

## Content Security Policy is incorrect

Depending on your browser, you may encounter an error when you don’t have the correct Content Security Policy.

- **Chrome:** A modal appears stating "Preview is not enabled on this storefront", and the storefront shows an error page stating "refused to connect".
- **Safari:** A modal appears stating "Preview is not enabled on this storefront", and the storefront isn't visible.

**Cause:** Your storefront doesn’t permit Runtime Admin in its Content Security Policy.

**Suggested Solution:** Follow the instructions in [Step 5](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/storefront-preview.md#5-update-the-storefront-content-security-policy-headers) to correctly configure your Content Security Policy.

## Storefront Preview loads the wrong domain

The initial page loaded by Storefront Preview is the domain configured as the External Hostname for the environment.

**Cause:** External Hostname isn't configured correctly in your environment settings.

**Suggested Solution:** Configure the External Hostname in the **Advanced** section of your [environment settings](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/managed-runtime-administration.md#edit-environment-settings) to point to the correct domain.

## Account Manager user is missing permissions for B2C Commerce instance

Response error message seen when clicking the **Preview** button:

```html
403 error: You don't have access to the shopper's tenant
```

**Suggested Solution:** Complete [Step 3](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/storefront-preview.md#3-confirm-that-your-account-manager-user-has-access-to-the-b2c-commerce-instance).

## Failed to set shopper context

Response error message seen when clicking the **Preview** button:

```html
400 error: Failed to get trusted system token, check your SLAS private client
```

**Cause:** Incorrect values in the MRT environment variables `SLAS_PRIVATE_CLIENT_ID` and `SLAS_PRIVATE_CLIENT_SECRET` or wrong SLAS private client configuration.

**Suggested Solution:** Complete [Step 1](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/storefront-preview.md#1-create-a-slas-private-client-for-your-b2c-commerce-instances) and [Step 2](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/storefront-preview.md#2-create-mrt-environment-variables-with-the-slas-private-client-details-and-the-commerce-api-short-code).

## Errors occurred after adding the onContextChange prop

While previewing your site after you added the `onContextChange` prop to the `StorefrontPreview` component, you may get error messages or unexpected results.

**Cause:** There may be an issue with the function called by the `onContextChange` prop.

**Suggested Solution:** Remove the `onContextChange` prop and the function it calls from the StorefrontPreview component. Then preview your site and see if the same issues occur. If they don’t, debug your function to resolve any errors. For example, you can:

- Add the `onContextChange` prop and the function it calls back to the StorefrontPreview component. See [Integrate with a Third-Party CMS](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/storefront-preview.md#integrate-with-a-third-party-cms).
- Inspect the network activity while previewing your site and see if the fetch request is sending the expected data.

If you still have issues after removing the `onContextChange` prop and the function it calls, open a support case.

## Other Unexpected Behavior

While previewing your site, content isn't displayed as expected and none of the above errors occur. For example, prices don't change based on the values you entered in Storefront Preview.

**Cause:** It's possible that you didn't complete one or more of the prerequisites.

**Suggested Solution:** Confirm that you've completed all of the [prerequisites](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/storefront-preview.md#prerequisites). If you did and you still encounter issues, open a support case.
