Skip to content

AngularNodeAppEngine: Injected REQUEST empty on first initialization #28995

Closed as not planned
@MarcoGlauser

Description

@MarcoGlauser

Command

run

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

We're in the process of moving from angular 18 with the webpack ssr builder to the angular 19 application builder with server routes, since request and response objects are now supported for dev builds.
However, we started getting a lot of errors during the first page load after starting a dev server.
It looks like on the start of the dev server, the first request injects a value of null for the REQUEST provider.

Minimal Reproduction

I've created a reproduction here:
https://github.com/MarcoGlauser/angular-19-ssr-request
https://stackblitz.com/github/MarcoGlauser/angular-19-ssr-request

When starting the server, the server console will output the following on the first page load, as if it's rendering the application twice:

provided request is null true
provided request is null false

The response that is sent to the browser seems to be from the second pass, but the first pass causes a lot of errors in our codebase, since we're expecting the request to be set for all SSR requests.

Exception or Error


Your Environment

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 19.0.2
Node: 22.11.0
Package Manager: npm 10.9.0
OS: linux x64

Angular: 19.0.1
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1900.2
@angular-devkit/build-angular   19.0.2
@angular-devkit/core            19.0.2
@angular-devkit/schematics      19.0.2
@angular/cli                    19.0.2
@angular/ssr                    19.0.2
@schematics/angular             19.0.2
rxjs                            7.8.1
typescript                      5.6.3
zone.js                         0.15.0

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions