0

Can I connect my local project to XM Cloud project? I created a custom tsx component and I tried to push it but I need scjssconfig.json.

  1. Can be the path to sitecore folder my path to local repository/src/sxastarted.
  2. Server hostname
  3. From where can I take Sitecore import service URL?

Thanks for your patience.

2 Answers 2

1

There are a few things to mention to answer this question:

First you can't "push" JSX files from your local environment to XM Cloud. That's just not how it works. The only way to get your code deployed is either the cli (dotnet sitecore cloud deployment create) or commit your code to your repository and deploy via your CI/CD pipelines.

You can connect your local Next.js application to XM Cloud by setting the GraphQL endpoint and API key in your .env file to point at the preview edge endpoint (https://xmc-wunderman-project-xmclouddemo4f2b.sitecorecloud.io//sitecore/api/graph/edge)

A better option for working locally would be to run XM Cloud in docker containers. The XMC-Foundation-Head repo (https://github.com/sitecorelabs/xmcloud-foundation-head) is read and setup for this. You can follow the directions here: (https://doc.sitecore.com/xmc/en/developers/xm-cloud/walkthrough--setting-up-your-full-stack-xm-cloud-local-development-environment.html)

When setup like this, your Next.js application is linked to the rendering host container with live updates, when you edit the .tsx files, they will reflect in your container instantly.

2
  • Hi @Richard. I tried this setup but i have next issue. When i run ./up.ps1, it starts me xmcloudcm.localhost/en/?sc_mode=edit, which is nice, but it isnt what i need. Anyway, in src/sxastarted, on .env.local i cloned my project from cloud and his components. All fine, i run in src/sxastarter jss start:connected and my project from cloud run perfect on localhost:3000. How can i create a custom component and deploy it to my localhost:3000, on content manager? Content manager for my project be accessed just from xm cloud and on local content manager i have default project. Sep 16, 2023 at 11:19
  • I forget to mention that when i run dotnet sitecore cloud project list to check the "xm Cloud Project": { "ref": "XMCLOUD", "allowWrite": true, "host": "xmc-wunderman-hwwukdigita38c4-xmclouddemo4f2b.sitecorecloud.io", "variables": {} }, i get "You are not authorized to perform the task you are attempting. You may need to be assigned additional permissions. It is a local project." Can i see somewhere these details? Sep 16, 2023 at 11:57
0

It is a bit unclear, what you want to achieve. First, as Richard mentioned, keep in mind the xmCloud deployment is different than a typical JSS application. Because both CM and rendering hosts are running inside Kubernetes containers, and the container images are immutable. You need to use Sitecore CLI for deployment, which basically creates a deployment for xmcloud Deploy App: https://deploy.sitecorecloud.io/.

If you want to use Sitecore Pages locally, your CM and Rendering host should be up and running, you need to set local storage entries, check it:

If you do not need to edit and just want to check your front-end code against the xmcloud(CM) or experience edge, then first, make sure your solution is deployed using Sitecore CLI/xmCloud Deploy app. Then you need to set the API endpoints, as Richard mentioned.

In .env file, from the root of your rendering, set the correct endpoint:


Connecting to xmCloud:

SITECORE_API_KEY=[Item ID of your API key in Sitecore]

SITECORE_API_HOST=https://xmc-wunderman-project-xmclouddemo4f2b.sitecorecloud.io

GRAPH_QL_ENDPOINT=https://xmc-wunderman-project-xmclouddemo4f2b.sitecorecloud.io/sitecore/api/graph/edge

Connecting to Edge:

SITECORE_API_KEY=[Edge Token]

SITECORE_API_HOST=https://edge.sitecorecloud.io/

GRAPH_QL_ENDPOINT=https://edge.sitecorecloud.io/api/graphql/v1


For local development, there is no need for deployment to the xmcloud. If you have any specific reason to do so, can you please provide it here?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.