Foundation-spa-react
Foundation-spa-react copied to clipboard
The Node.JS application failed to respond within the given startup time
Hi everyone!
I encountered an error while deploying the project:
fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1] An unhandled exception has occurred while executing the request. System.ApplicationException: The Node.JS application failed to respond within the given startup time at HeadlessCms.Infrastructure.NodeJsMiddleware.NodeJsProcess.WhenReady(CancellationToken cancellationToken) in D:\Projects\Optimizely\FoundationSpaReact\Foundation-spa-react\src\Headless.Cms\Infrastructure\NodeJsMiddleware\NodeJsProcess.cs:line 92 at HeadlessCms.Infrastructure.NodeJsMiddleware.NodeJsMiddleware.InvokeAsync(HttpContext context) in D:\Projects\Optimizely\FoundationSpaReact\Foundation-spa-react\src\Headless.Cms\Infrastructure\NodeJsMiddleware\NodeJsMiddleware.cs:line 56 at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext) at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) at SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware.Invoke(HttpContext httpContext, Boolean retry) at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
I get this error when I run the Headless.Cms project (back-end part). I followed the instructions for deploying the backend and frontend as described in the Readme file.
Backend part: On the backend side, I successfully executed the commands from point 1.2. Installation. I changed the data in the appsettings.json file in accordance with paragraph 1.3. Service configuration. After that, I decided to launch the site, and, as written in the documentation, the content began to load (I understood this because additional tables began to be created in the database and content was loaded into them). After the content download was completed, I launched the site at this address https://localhost:8001/ - I successfully logged in and checked that there were many content pages in the content tree. I also checked that my user has the 2 required roles WEBADMINS and ADMINISTRATORS in accordance with paragraph 2.1. Configure user accounts. And the last step in setting up the backend was changing the NodeJsMiddleware section in the appsettings.json file, namely, I set port 3000 to listen to the frontend and “Disabled”: “false” to run a JavaScript based frontend as child process of the .Net webserver, as well as several other options in this section.
Frontend part: Everything is much simpler here - I successfully completed the entire sequence of commands, including changing the site ID in the "OPTIMIZELY_DXP_SITE_ID" parameter.
And this is what I have as a result:
Backend - home page doesn't load (in the backend console i've the same issue):
Frontend console:
Frontend website with 404 error:
EPiServer works correctly and we see the content, but due to the same error we cannot view it:
We see that the frontend is trying to get some data from this URL https://localhost:8001/ but due to a backend error it cannot be done and the frontend side (http://localhost:3000/) does not load the site content.
Also I have a question, is setting up OpenID Connect a requirement? In particular, I am interested in the relevance of setting point 3.2. Applications.
I will be very glad to receive some advice to help launch this headless solution, it seems like some final piece is missing. Thanks for any help. @remkoj
I have the same issue - I was able to to run the front-end part with the command that back-end is trying to execute
C:\path\to\node.exe --require=C:\repos\Foundation-spa-react\src\frontend\.pnp.cjs --loader=file:///C:\repos\Foundation-spa-react\src\frontend\.pnp.loader.mjs C:\repos\Foundation-spa-react\src\frontend\dotnet.js 3000
and it runs successfully, however returns 404, that's why the back-end reports ApplicationException("The Node.JS application failed to respond within the given startup time").
My best guess is that something have changed with Content Delivery API integration, but haven't been able to pin-point the exact issue.