Closed as not planned
Closed as not planned
Description
Command
serve
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
Using async handlers with Express v5 and a freshly scaffolded Angular project results in a deprecation warning being logged:
router deprecated handlers that are Promise-like are deprecated, use a native Promise instead
Minimal Reproduction
ng new
choose "Yes" to enable SSR
In the scaffolded server.ts
rewrite this:
app.use((req, res, next) => {
angularApp
.handle(req)
.then((response) =>
response ? writeResponseToNodeResponse(response, res) : next(),
)
.catch(next);
});
to:
app.use(async (req, res, next) => {
try {
const response = await angularApp.handle(req);
if (response) {
writeResponseToNodeResponse(response, res);
} else {
next();
}
} catch {
next();
}
});
Now run ng serve
and open a browser to http://localhost:4200. Once the page has loaded, hit the refresh button on the browser one time and then observe the console output.
Exception or Error
router deprecated handlers that are Promise-like are deprecated, use a native Promise instead
Your Environment
Angular CLI: 20.0.4
Node: 22.12.0
Package Manager: npm 11.3.0
OS: win32 x64
Angular: 20.0.5
... common, compiler, compiler-cli, core, forms
... platform-browser, platform-server, router
Package Version
------------------------------------------------------
@angular-devkit/architect 0.2000.4
@angular-devkit/core 20.0.4
@angular-devkit/schematics 20.0.4
@angular/build 20.0.4
@angular/cli 20.0.4
@angular/ssr 20.0.4
@schematics/angular 20.0.4
rxjs 7.8.2
typescript 5.8.3
zone.js 0.15.1
Anything else relevant?
No response
Metadata
Metadata
Assignees
Labels
No labels