#no knowledge in troubleshooting this "ERROR TypeError: serializedViews is not iterable" ng-17 ssr

9 messages · Page 1 of 1 (latest)

torn horizon
#

i'm getting this error:

ERROR TypeError: serializedViews is not iterable
at locateDehydratedViewsInContainer (core.mjs:14267:34)
at populateDehydratedViewsInLContainerImpl (core.mjs:16464:44)
at locateOrCreateAnchorNode (core.mjs:16479:10)
at createContainerRef (core.mjs:16376:5)
at injectViewContainerRef (core.mjs:16136:12)
at lookupTokenUsingNodeInjector (core.mjs:5813:25)
at getOrCreateInjectable (core.mjs:5772:23)
at ɵɵdirectiveInject (core.mjs:11050:19)
at ɵɵinject (core.mjs:1106:42)
at inject (core.mjs:1192:12)
in main.ts while doing ssr and in ng serve. Since i have seldom edited these files i don't know how to troubleshoot the error as there is no Q&A raised by anyone of this issue. i'll post the necessary files to give solutions from you experts.

i have added them in this google docs please review and give me solution along with an explanation why it is not working.
https://docs.google.com/document/d/15Ai3KZ_rENutFkmXthwd_cPYCunLI_b90FgIkvo8RpE/edit?usp=sharing

stray lava
#

Does this happen in Dev, too? The error message should be differen in that case ("Unexpected state: no hydration info available for a given TNode, which represents a view container.").
How are you deploying your app to production? Is there anything in the production setup that could change the HTML produced by SSR/SSG?

torn horizon
#

@stray lava now i managed to make build:ssr and serve:ssr work but in development and dev:ssr i get this and the app is too slow

stray lava
#

Sorry, but this is very hard to diagnose with just some screenshots/stacktraces

torn horizon
#

i understand i'll update with the file contents in a google doc soon. Now i managed to make the app work but the server console gives this error

torn horizon
#

@stray lava
here is the updated doc with the necessary files and code
https://docs.google.com/document/d/15Ai3KZ_rENutFkmXthwd_cPYCunLI_b90FgIkvo8RpE/edit?tab=t.0

stray lava
#

The error is now different, NG05104 means "root element not found". Look into the HTML generated by the server.

Also: Google Docs is really not a great way to share code.

torn horizon
#

@stray lava i'm a noob to ssr i need explanations and solutions from experts like you. i troubleshooted a bit and when i run dev:ssr it runs fine with warnings only about scss.
but when i do ng serve it shows this error once again. to ease your solution making process i have created a minimal reproduction for you to see in stackblitz. check it out don't commit any changes on your side.