0

We are running Next.js JSS app using XM Cloud docker setup, our localhost:3000 site is loading, but when we are trying to run Experience Editor it is giving 2 erros.

On First Try we are getting below error:

A Sitecore.JavaScriptServices application was not found for the path {itempath}. You should ensure that:
* You have applied a Sitecore configuration patch for the application (see App_Config\Sitecore\JavaScriptServices\Sitecore.JavaScriptServices.ExampleApp.config.example)
> * The path represents a Route
* The Route item is a descendant of an App item

If I change the URL with query string sc_site to sc_jssapp it is giving us below error

2836 06:24:55 ERROR [JSS] Error occurred during POST to remote rendering host: `http://localhost:3000/api/editing/render`
2836 06:24:55 ERROR Unable to connect to the remote server
Exception: System.Net.WebException
Message: Unable to connect to the remote server
Source: System
   at System.Net.WebClient.UploadDataInternal(Uri address, String method, Byte[] data, WebRequest& request)
   at System.Net.WebClient.UploadString(Uri address, String method, String data)
   at Sitecore.JavaScriptServices.ViewEngine.Http.RenderEngine.Invoke[T](String moduleName, String functionName, Object[] functionArgs)

Nested Exception

Exception: System.Net.Sockets.SocketException
Message: No connection could be made because the target machine actively refused it 127.0.0.1:3000
Source: System
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)

We have already checked JSS_Editing Secret in .env file and Sitecore config.

1 Answer 1

0

You make request from Sitecore container. localhost on the Sitecore container is not equal to localhost on your local machine.

enter image description here

Localhost inside container is this container address. You can't request from the Docker container your sites that are hosted on your machine. What you can do: setup rendering host container inside your Docker network and change http://localhost:3000/api/editing/render to the address of your rendering host container, e.g. http://localhost:3000/api/editing/render

1
  • 1
    Thanks I am able to resolve both the issues by changing localhost:300 to rendering:3000 and also sc_site querystring param is also working fine by changing app item template and home item template to route template in jss Mar 10 at 3:01

Your Answer

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

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