Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
640 views
in Technique[技术] by (71.8m points)

spartacus storefront - SSR rendering exceeded timeout, fallbacking to CSR for (all routes)

I created a new angular project and ran the following command: ng add @spartacus/schematics --baseUrl https://spartacus-demo.eastus.cloudapp.azure.com:8443/ --baseSite=electronics-spa --ssr. After, I ran the command npm run dev:ssr, opened http://localhost:4200 and found the following problem:

enter image description here

Any ideas how to correct this bug and make the app run SSR instead of CSR? This warning message is showing for every route I try to access.

(https://github.com/SAP/spartacus/issues/10638)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

it's because of SSR optimization feature available in Spartacus 3.0 and up.

You can either extend the timeout in your server.ts (passing a second parameter to NgExpressEngineDecorator.get method) or set it to 0, so it won't be fallbacking to CSR at all. Here is an example:

const ngExpressEngine = NgExpressEngineDecorator.get(engine, { timeout: 0 });

You can use API documentation to get a list of available options: https://sap.github.io/spartacus/interfaces/SsrOptimizationOptions.html

Additionally, an extended documentation regarding this feature is on its way and should be available soon.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...