TrilonIO / aspnetcore-angular-universal

ASP.NET Core & Angular Universal advanced starter - PWA w/ server-side rendering for SEO, Bootstrap, i18n internationalization, TypeScript, unit testing, WebAPI REST setup, SignalR, Swagger docs, and more! By @TrilonIO
https://www.trilon.io
MIT License
1.46k stars 433 forks source link

Call to Node module failed with error: Prerendering timed out after 30000ms because the boot function in 'D:\\home\\site\\wwwroot/ClientApp/dist/main-server' returned a promise that did not resolve or reject. #701

Open SouravKumar89 opened 5 years ago

SouravKumar89 commented 5 years ago

`` routererror

Below is my Routing code - where while deploying in server the router is throwing the above(image) error if we are refreshing route other '/home' or '/' .

app-Routing.ts file-->


const appRoutes: Routes = [ { path: '', redirectTo: 'home', pathMatch: 'full', data: { name: 'home' } }, { path: 'home', component: HomeComponent, data: { name: 'home', title: 'Home' } }, { path: 'terms', loadChildren: './containers/terms/terms.module#TermsModule', data: { name: 'terms', title: 'Terms' } }, { path: 'policy', component: PolicyComponent,, data: { name: 'policy', title: 'Policy' } }]


I have implemented lazy loading also for some component as you can see. Every thing is working fine in Local but with AOT production it's running fine with router btn click navigation but not with refreshing any other page other than home page. my webpack version is-2.2.0 and "aspnet-webpack": "^2.0.1", Can anyone help me! is it lazy loading issue or something else!!

nsaban commented 5 years ago

Hi I had a similar bug. Try increasing the timeout in class HttpRequestExtensions from 30000 to a higher value

SouravKumar89 commented 5 years ago

@nsaban - ok i'll try that.

SouravKumar89 commented 5 years ago

i tried changing the httprequestExceptions to 100000ms but then it thrown this error-

Microsoft.AspNetCore.NodeServices.HostingModels.NodeInvocationException: The Node invocation timed out after 60000ms.\r\nYou can change the timeout duration by setting the InvocationTimeoutMilliseconds property on NodeServicesOptions.\n\nThe first debugging step is to ensure that your Node.js function always invokes the supplied callback (or throws an exception synchronously), even if it encounters an error. Otherwise, the .NET code has no way to know that it is finished or has failed.\r\n at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.d13`1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.d10`1.MoveNext()\r\n---

GetTaxSolutions commented 5 years ago

I also have similar problem. In my case I have lazy loading in routing and I'm adding sub routes children in the module using: @NgModule({ imports: [ RouterModule.forChild(routes) ], exports: [RouterModule] })

When I try to reload some of these lazy loaded children routes or hit directly in URL:

{"statusCode":500,"message":"Prerendering timed out after 30000ms because the boot function in '/ClientApp/dist/main-server' returned a promise that did not resolve or reject. Make sure that your boot function always resolves or rejects its promise. You can change the timeout value using the 'asp-prerender-timeout' tag helper.\r\n"}

My Microsoft.AspNetCore.All is version 2.2.0