When I upgrade to Angular 8,and run the spa project on ssr mode,it thorw the timeout exception:
The prerendering build process did not complete within the timeout period of 50 seconds.
Steps to reproduce the behavior:
AngularCliBuilder
,build the ssr bundles with angular-cli and it work..my ssr options:
app.UseSpa(spa =>
{
spa.Options.SourcePath = "ClientApp";
spa.UseSpaPrerendering(options =>
{
options.BootModulePath = $"{spa.Options.SourcePath}/dist/server/main.js";
options.BootModuleBuilder = env.IsDevelopment()
? new AngularCliBuilder(npmScript: "build:ssr")
: null;
options.ExcludeUrls = new[] { "/sockjs-node" };
options.SupplyData = (context, data) =>
{
data.Add("Cookies", context.Request.Cookies);
};
});
if (env.IsDevelopment())
{
//spa.UseAngularCliServer(npmScript: "start");
spa.UseProxyToSpaDevelopmentServer("http://localhost:4200");
}
});
If applicable, add screenshots to help explain your problem.
output of dotnet --info
.NET Core SDK(反映任何 global.json):
Version: 3.0.100-preview4-011223
Commit: 118dd862c8
运行时环境:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.0.100-preview4-011223\
Host (useful for support):
Version: 3.0.0-preview4-27615-11
Commit: ee54d4cbd2
.NET Core SDKs installed:
2.2.204 [C:\Program Files\dotnet\sdk]
3.0.100-preview4-011223 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0-preview4-19216-03 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0-preview4-27615-11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0-preview4-27613-28 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Thanks for contacting us.
We're currently busy wrapping up our upcoming release and we will try to help you out with this during the next milestone. In the meantime, please ask your question in StackOverflow using the asp.net-core-mvc tag, in case you'll get faster help there. Appreciate your understanding.
I got the same problem as well with a minimal Server Side Rendered SPA unfortunately (from here) - which doesn't really help, but at least you know you're not alone!
Just ran into this myself during an Angular 8 upgrade. It appears the output of the SSR build process no longer contains output matching the Regex("Date") as required by https://github.com/aspnet/AspNetCore/blob/7269dbb73f4aa0ebf5ebb8bc07a076ee181851be/src/Middleware/SpaServices.Extensions/src/AngularCli/AngularCliBuilder.cs#L65
Under Angular 8, my build:ssr output is as follows (this is based on output generated by @angular-devkit/build-angular:server):
Hash: 7ed827808cf36ae1a2bc
Time: 17502ms
Built at: 07/05/2019 2:41:31 PM
Asset Size Chunks Chunk Names
main.js 10.9 MiB main [emitted] [big] main
Entrypoint main [big] = main.js
chunk {main} main.js (main) 10.6 MiB [entry] [rendered]
However, the browser build still contains the string "Date":
chunk {main} main.js, main.js.map (main) 189 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 388 kB [initial] [rendered]
chunk {polyfills-es5} polyfills-es5.js, polyfills-es5.js.map (polyfills-es5) 474 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 8.99 kB [entry] [rendered]
chunk {scripts} scripts.js, scripts.js.map (scripts) 6.74 kB [entry] [rendered]
chunk {styles} styles.css, styles.css.map (styles) 248 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 7.06 MB [initial] [rendered]
Date: 2019-07-05T22:32:03.642Z - Hash: 8114fd85771536983b1f - Time: 20299ms
@ElderJames @JasonBro My extremely naive workaround for now is to append an "echo Date" to the end of my build:ssr script definition in package.json, e.g.:
"build:ssr": "ng build --configuration=production --project=test-spa-ssr && echo Date",
This works around the issue for me.
I've just been able to implement SSR for .NET Core 2.2 and angular 8.1
My code is based on the following working repo: https://github.com/joshberry/dotnetcore-angular-ssr
My final code, with a wrap-up of what I did is here: https://github.com/PieterjanDeClippel/AspNetCoreSpaPrerendering
I've also written a Medium article about this: https://medium.com/@pieterjandeclippel/server-side-rendering-in-asp-net-core-angular-6df7adacbdaa
I have to note that during development, the server build takes a while, causing the ClientApp/dist/server folder to appear after some minutes. The angular app will have already launched and loaded and the dist folder doesn't exist yet.
Just wait until the ClientApp/dist/server folder is created, restart debugging and notice your working SSR.
Any progress in this issue? esoderquist's workaround works, but does not seem to be a durable solution.
Thank you for contacting us. Due to no activity on this issue we're closing it in an effort to keep our backlog clean. If you believe there is a concern related to the ASP.NET Core framework, which hasn't been addressed yet, please file a new issue.
Most helpful comment
Just ran into this myself during an Angular 8 upgrade. It appears the output of the SSR build process no longer contains output matching the Regex("Date") as required by https://github.com/aspnet/AspNetCore/blob/7269dbb73f4aa0ebf5ebb8bc07a076ee181851be/src/Middleware/SpaServices.Extensions/src/AngularCli/AngularCliBuilder.cs#L65
Under Angular 8, my build:ssr output is as follows (this is based on output generated by @angular-devkit/build-angular:server):
However, the browser build still contains the string "Date":
@ElderJames @JasonBro My extremely naive workaround for now is to append an "echo Date" to the end of my build:ssr script definition in package.json, e.g.:
"build:ssr": "ng build --configuration=production --project=test-spa-ssr && echo Date",
This works around the issue for me.