You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Prerendering fails with undefined stack trace on invalid http calls #28740
Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
When using SSR, you typically wrap http calls in an afterRender or afterNextRender lifecycle hook. If not doing so it might happen that prerendering fails when e.g. the url is either invalid, unreachable or does not return JSON. In this you'll get an error which doesn't really tell you a lot of context what is going on:
✘ [ERROR] An error occurred while prerendering route '/test'.
undefined
My expectation is that there should be some better error message to tell the user what (s)he is doing wrong.
We should improve the error message although I suspect this has been addressed in v19 which is currently in prerelease. I’ll verify and get back to you on this.
When using SSR, you typically wrap http calls in an afterRender or afterNextRender lifecycle hook.
I haven’t seen usage of this approach and truth this approach would be far from ideal. This could lead to hydration mismatches, it’s best to make HTTP requests directly during SSR, ensuring that the view is fully rendered on the server. This way, when the page hydrates on the client side, it can use the data already fetched by the server, keeping everything in sync.
Activity
alan-agius4 commentedon Oct 29, 2024
We should improve the error message although I suspect this has been addressed in v19 which is currently in prerelease. I’ll verify and get back to you on this.
I haven’t seen usage of this approach and truth this approach would be far from ideal. This could lead to hydration mismatches, it’s best to make HTTP requests directly during SSR, ensuring that the view is fully rendered on the server. This way, when the page hydrates on the client side, it can use the data already fetched by the server, keeping everything in sync.
alan-agius4 commentedon Oct 30, 2024
Confirmed that this has been addressed in version 19. I'll back port the fix to version 18.
fix(@angular/build): show error message when error stack is undefined
fix(@angular/build): show error message when error stack is undefined
alan-agius4 commentedon Oct 30, 2024
Closed via #28744
angular-automatic-lock-bot commentedon Nov 30, 2024
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.