Migrating Off of the Contentful Preview Connector

Last updated: May 9, 2024

Effective from 2023, it is essential for all users to promptly remove the @nacelle/contentful-preview-connector package from their tech stack. Continuing to utilize this package may lead to unexpected errors, which could potentially disrupt operations. However, we have a straightforward solution to address this concern.

Let's start by removing the Preview Connector:

const contentfulConnector = createContentfulPreviewConnector(client, {
  contentfulConfig: {
    space: "contentful_space_id",
    accessToken: "your_access_token",
  },
});

Next, we'll utilize the @nacelle/storefront-sdk's ability to enter/exit preview mode by adding the previewToken parameter:

const client = Storefront({
  storefrontEndpoint: '<your-nacelle-storefront-endpoint>', 
  token: '<your-nacelle-public-storefront-token>',  
  previewToken: '<your-nacelle-preview-token>' // NEW
}); 

More instructions on implementing previews can be found here.