From cb42aa8b0891cbcb13ad52c6e89965fccff85f16 Mon Sep 17 00:00:00 2001 From: Anca Emcken Date: Wed, 7 Jul 2021 15:48:22 +0200 Subject: [PATCH 1/5] Move video demonstration for better fit --- .../docs/nextjs/deploying-to-production/vercel/en.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/data/routes/docs/nextjs/deploying-to-production/vercel/en.md b/docs/data/routes/docs/nextjs/deploying-to-production/vercel/en.md index 7f9680dfc5..754a0e3970 100644 --- a/docs/data/routes/docs/nextjs/deploying-to-production/vercel/en.md +++ b/docs/data/routes/docs/nextjs/deploying-to-production/vercel/en.md @@ -18,6 +18,13 @@ This guide will demonstrate deploying the Next.js sample app that's generated by * `GRAPH_QL_ENDPOINT` - your GraphQL endpoint. The `GRAPH_QL_ENDPOINT` is required for Sitecore Experience Edge. For Sitecore XM, this is typically optional. By default, the endpoint is calculated using the resolved Sitecore API hostname + the `graphQLEndpointPath` defined in your `package.json`. 3. Push the changes to your Git provider. +## Video demonstration + +

+ Watch the following video to see the deployment process and get some tips. + +

+ ## `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. @@ -33,9 +40,4 @@ To enable the `Publish:end` hook, you must: 4. Publish items. 5. On Vercel, check that the end of the publishing process triggered a new deployment. -## Video demonstration -

- Watch the following video to see the deployment process and get some tips. - -

From ffa65cbb034d96399e89c02243eb98be6dc4ceb7 Mon Sep 17 00:00:00 2001 From: Anca Emcken Date: Wed, 7 Jul 2021 15:49:14 +0200 Subject: [PATCH 2/5] Add link to Edge docs --- .../routes/docs/nextjs/deploying-to-production/vercel/en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/data/routes/docs/nextjs/deploying-to-production/vercel/en.md b/docs/data/routes/docs/nextjs/deploying-to-production/vercel/en.md index 754a0e3970..caa79a1745 100644 --- a/docs/data/routes/docs/nextjs/deploying-to-production/vercel/en.md +++ b/docs/data/routes/docs/nextjs/deploying-to-production/vercel/en.md @@ -12,7 +12,7 @@ This guide will demonstrate deploying the Next.js sample app that's generated by 1. Execute the steps provided in the Next.js guide for [Getting Started](https://nextjs.org/docs/deployment#getting-started) with deployment. 2. Add [environment variables](https://nextjs.org/docs/basic-features/environment-variables#environment-variables-on-vercel) 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. For Sitecore XM, the `SITECORE_API_KEY` will be your Sitecore SSC API key. For Sitecore Experience Edge, this will be the API key provisioned here. + * `SITECORE_API_KEY` - your Sitecore API key. For Sitecore XM, the `SITECORE_API_KEY` will be your Sitecore SSC API key. For Sitecore Experience Edge, this will be the [API key provisioned here](https://doc.sitecore.com/developers/101/developer-tools/en/test-your-queries.html). * `SITECORE_API_HOST` - your Sitecore API hostname. The `SITECORE_API_HOST` is not required for Sitecore Experience Edge. * `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](/docs/nextjs/experience-editor/walkthrough). * `GRAPH_QL_ENDPOINT` - your GraphQL endpoint. The `GRAPH_QL_ENDPOINT` is required for Sitecore Experience Edge. For Sitecore XM, this is typically optional. By default, the endpoint is calculated using the resolved Sitecore API hostname + the `graphQLEndpointPath` defined in your `package.json`. From c834688191e7dbe4374b33cd3cf98448f0760037 Mon Sep 17 00:00:00 2001 From: Anca Emcken Date: Thu, 8 Jul 2021 11:28:59 +0200 Subject: [PATCH 3/5] Add Edge alternative to publish:end hook config --- .../deploying-to-production/vercel/en.md | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/docs/data/routes/docs/nextjs/deploying-to-production/vercel/en.md b/docs/data/routes/docs/nextjs/deploying-to-production/vercel/en.md index caa79a1745..eea9454433 100644 --- a/docs/data/routes/docs/nextjs/deploying-to-production/vercel/en.md +++ b/docs/data/routes/docs/nextjs/deploying-to-production/vercel/en.md @@ -29,7 +29,7 @@ This guide will demonstrate deploying the Next.js sample app that's generated by 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: +To enable the `Publish:end` hook: 1. [Create a deploy hook](https://vercel.com/docs/more/deploy-hooks#creating-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: @@ -40,4 +40,26 @@ To enable the `Publish:end` hook, you must: 4. Publish items. 5. On Vercel, check that the end of the publishing process triggered a new deployment. +## Webhooks on Edge +Instead of triggering a webhook when the publishing process finalizes in Sitecore, if you are using Sitecore Experience Edge, you can trigger webhooks when your data reaches the Edge Delivery Platform. + +You can register, update, remove or list webhooks with the help of the Experience Edge [Admin API](https://doc.sitecore.com/developers/101/developer-tools/en/admin-api.html). + +> Before using the Admin API for any operations, make sure to [obtain an authentication token](https://doc.sitecore.com/developers/101/developer-tools/en/request-a-jwt-for-experience-edge-xm-using-oauth.html). + +To trigger a new deployment on Vercel when your data reaches the Edge Delivery Platform: + +1. [Create a deploy hook](https://vercel.com/docs/more/deploy-hooks#creating-a-deploy-hook) in Vercel and copy the URL of the webhook. +2. Send a `POST` request to the Admin API webhook endpoint `https://edge.sitecorecloud.io/api/admin/v1/webhook` as follows: +```json +{ + "label": "My new webhook", + "createdBy": "SOME_USER_ID", + "uri": "YOUR_VERCEL_WEBHOOK_URL", + "method": "GET" +} +``` +3. To verify the request completed successfully, check that you received a `201 Created` response status code. +4. Make some changes in Sitecore and publish. +5. When the Experience Edge finishes processing the new data, the publishing process is complete and Vercel should start a new deployment. From 2f82323d85f8597ca5eacc787b0d2e1034cd316f Mon Sep 17 00:00:00 2001 From: Anca Emcken Date: Thu, 8 Jul 2021 11:46:39 +0200 Subject: [PATCH 4/5] Add link to API provisioning docs for Edge --- .../routes/docs/techniques/ssr/sitecore-experience-edge/en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/data/routes/docs/techniques/ssr/sitecore-experience-edge/en.md b/docs/data/routes/docs/techniques/ssr/sitecore-experience-edge/en.md index c1db61e151..0a748e1017 100644 --- a/docs/data/routes/docs/techniques/ssr/sitecore-experience-edge/en.md +++ b/docs/data/routes/docs/techniques/ssr/sitecore-experience-edge/en.md @@ -70,7 +70,7 @@ You can set the following environment variables to configure the SSR sample inst | Parameter | Description | | ----------------------------------- | ------------------------------------------------------------ | | `SITECORE_JSS_APP_NAME` | The JSS app's name. Used when request layout data and dictionary using graphql query and the default value of `SITECORE_JSS_SERVER_BUNDLE` if not set. | -| `SITECORE_API_KEY` | The API key provisioned on Sitecore Experience Edge. | +| `SITECORE_API_KEY` | [The API key provisioned on Sitecore Experience Edge.](https://doc.sitecore.com/developers/101/developer-tools/en/test-your-queries.html) | | `SITECORE_JSS_SERVER_BUNDLE` | Path to the JSS app's `server.bundle.js` file. | | `SITECORE_EXPERIENCE_EDGE_ENDPOINT` | Sitecore Experience Edge endpoint. | | `DEFAULT_LANGUAGE` | The JSS app's default language. Used to determine language context if language unspecified in the request URL. | From 618016f0273d466f9d720fc361f42cf0e8246ff8 Mon Sep 17 00:00:00 2001 From: Anca Emcken <1617798+ancaemcken@users.noreply.github.com> Date: Fri, 9 Jul 2021 08:55:28 +0200 Subject: [PATCH 5/5] Add Sitecore XM detail to publish:end webhook --- .../routes/docs/nextjs/deploying-to-production/vercel/en.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/data/routes/docs/nextjs/deploying-to-production/vercel/en.md b/docs/data/routes/docs/nextjs/deploying-to-production/vercel/en.md index eea9454433..279c5cb895 100644 --- a/docs/data/routes/docs/nextjs/deploying-to-production/vercel/en.md +++ b/docs/data/routes/docs/nextjs/deploying-to-production/vercel/en.md @@ -25,9 +25,9 @@ This guide will demonstrate deploying the Next.js sample app that's generated by

-## `publish:end` webhook invocation +## Sitecore XM `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. +Using the Sitecore XM `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: