Skip to content

SSR isMainModule function return false when node app server is launched by Phusion Passenger #28993

@bertrand-ravier

Description

@bertrand-ravier

Command

other

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

18.0.4

Description

Hi,

My application is served on a Plesk server, which first launch Phusion Passenger before executing the node application. With Angular v 18.0.4, all worked fine.

I updated to Angular 19.0.x. Everything works fine in local environment. But when deployed, I can access to the root page (probably served by Nginx or Apache) and I can navigate to other pages in client side. But I get a timeout when requesting another page from server side. The node application is not listening for incoming requests.

The problem comes from the isMainModule(url) function, that test the first argument on the command line. I do not launch myself the node server, it is launch with Phusion Passenger. Perhaps it adds some other arguments to the command line.

I bypassed the test argv[1] === fileURLToPath(url) with a local variable process.env['RUN'] set in dev and production environnements. It allow to build without error (because I do not pass this variable when building) and when executing the server it now listen for requests.

Minimal Reproduction

Create an Angular v19 project, with SSR, and a route to a component (/ssr for example).
Deploy to a server with Phusion Passenger configurated to launch a node application.
Go to the route /ssr and wait for the timeout to occur.

Exception or Error


Your Environment

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

Angular CLI: 19.0.2
Node: 20.15.0
Package Manager: npm 10.9.1
OS: darwin arm64

Angular: 19.0.1
... animations, cdk, common, compiler, compiler-cli, core, forms
... material, 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