-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prerendering fails with undefined stack trace on invalid http calls #28740
Comments
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. |
Confirmed that this has been addressed in version 19. I'll back port the fix to version 18. |
Handle cases where the error stack is missing by displaying a relevant message. Closes angular#28740
Handle cases where the error stack is missing by displaying a relevant message. Closes #28740
Closed via #28744 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Command
build, serve
Is this a regression?
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:
My expectation is that there should be some better error message to tell the user what (s)he is doing wrong.
Minimal Reproduction
Exception or Error
✘ [ERROR] An error occurred while prerendering route '/test'.
undefined
Your Environment
Angular CLI: 18.2.10
Node: 22.9.0
Package Manager: npm 10.8.3
OS: linux x64
Angular: 18.2.9
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router
Package Version
@angular-devkit/architect 0.1802.10
@angular-devkit/build-angular 18.2.10
@angular-devkit/core 18.2.10
@angular-devkit/schematics 18.2.10
@angular/cli 18.2.10
@angular/ssr 18.2.10
@schematics/angular 18.2.10
rxjs 7.8.1
typescript 5.5.4
zone.js 0.14.10
Anything else relevant?
No response
The text was updated successfully, but these errors were encountered: