Read and search through all the Sitecore JSS documentation

Walkthrough: Deploying to Vercel

Vercel is an all-in-one platform with Global CDNs supporting deployment and delivery of static & Jamstack apps. Vercel has first-class support for Next.js.

This guide will demonstrate deploying the Next.js sample app that's generated by the jss create command to Vercel. Assuming you already have the sample app set up and connected to a Sitecore instance, complete the following steps to deploy the sample app to production:

  1. Execute the steps provided in the Next.js guide for Getting Started with deployment.
  2. Add environment variables to Vercel or modify .env file. We recommend to use environment variables in Vercel:
    • PUBLIC_URL - your Vercel deployment URL.
    • SITECORE_API_KEY - your Sitecore API key is needed to build the app.
    • SITECORE_API_HOST - your Sitecore API hostname.
    • JSS_EDITING_SECRET - your secret token. The JSS_EDITING_SECRET is optional for deployments but necessary if you want to use the Experience Editor with your Next.js Vercel deployment. Read about connecting your Next.js application to the Experience Editor.
  3. Push the changes to your Git provider.

publish:end webhook invocation

Using the publish:end webhook, you can automatically trigger static site generation, cache clearing, and other automated activities with webhook support.

To enable the Publish:end hook, you must:

  1. Create a deploy hook in Vercel.
  2. Create webhook config based on example /App_Config/Sitecore/JavaScriptServices/Sitecore.JavaScriptServices.AppServices.PublishingWebHook.config.example, and include it in your solution:
    • url - Required. The URL of the hook to be invoked.
    • method - Optional. The HTTP method for invoking webhook. Possible values are POST or GET. The default method is POST.
    • site - Optional. The sites which should trigger the webhook when published. By default, Sitecore will trigger the webhook for every published item. If you provide the site parameter, the webhook will be invoked if the published item root is an ancestor, descendant, or equal to the configured site's root item.
  3. Deploy webhook config to your Sitecore instance.
  4. Publish items.
  5. On Vercel, check that the end of the publishing process triggered a new deployment.

Found a problem? Have something to add? Edit this on GitHub