Skip to content

How to use Edge Context ID in front-end? #2044

Closed Answered by illiakovalenko
ahiyalala asked this question in Help
Discussion options

You must be logged in to vote

@ahiyalala Hello! The sitecoreEdgeContextId should be passed as a query string parameter in the request to the Edge endpoint. The apiKey property should only be used when working with a local Sitecore instance or Sitecore XP.

Out of the box, the sitecore-jss package provides getEdgeProxyContentUrl, which you can use to construct an endpoint URL.

We'll consider adding this topic in our documentation

Here’s an example of how to use it with Next.js:

import { GraphQLRequestClient, getEdgeProxyContentUrl } from '@sitecore-jss/sitecore-jss-nextjs/graphql'; 

const client = new GraphQLRequestClient(getEdgeProxyContentUrl('<your-context-id>'));

client.request('<your-query>');

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ahiyalala
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants