Skip to content

SWA broken as of node version 20.13.0 #829

Closed

Description

@cr3wdayt5p

Describe the bug
The SWA CLI does not work with node version 20.13.0 or later (also tested with 20.13.1 and 22.1.0).

There are no issues with node 20.12.2.

Running swa start does not report any errors. However after succesful startup of swa start the URL https://127.0.0.1:8082 (or https://localhost:8082) simply refuse connections (Chrome report ERR_CONNECTION_REFUSED).

To Reproduce
Steps to reproduce the behavior:

  1. With node 20.12.2 setup some SWA project. Verify that swa start work as expected.
  2. Upgrade to node 20.13.0. SWA is no longer working (but swa start report no errors).

Expected behavior
Nothing should break upgrading from node 20.12.2 to 20.13.0 (or later).

Desktop (please complete the following information):

  • OS: macOS 14.4 (arm64)
  • SWA CLI version: 1.1.7

Additional context

swa-cli.config.json:

{
  "configurations": {
    "app": {
      "appDevserverUrl": "https://127.0.0.1:8081",
      "host": "127.0.0.1",
      "port": 8082,
      "ssl": true,
      "sslCert": "localhost-cert/localhost.crt",
      "sslKey": "localhost-cert/localhost.key"
    }
  }
}

Activity

  1. bzbetty commented on May 16, 2024

    @bzbetty

    can reproduce.

    seems that it's binding to the external ip of the local machine.

  2. codingoutloud commented on May 21, 2024

    @codingoutloud
    Contributor

    Also reproduced.

    swa --version =
    1.1.8

    sw_vers =
    ProductName: macOS
    ProductVersion: 14.5
    BuildVersion: 23F79

  3. yamachu commented on May 29, 2024

    @yamachu
    Contributor

    I investigated and it seems that there has been a change in the behavior of node's http module.
    ref: nodejs/node#53204

    There are two ways to deal with this.
    The first is to access it with a localIpAdress address. (e.g. 192.168.xxx.xxx)
    The second is to remove the following line (I would like to ask for instructions from the product owner 👀)

    server.listen(Number(SWA_CLI_PORT), localIpAdress);

    If you do either of these, it looks like you can get it to work with

  4. johnnyreilly commented on Jun 18, 2024

    @johnnyreilly

    Yusuke Yamada (@yamachu) can you expand on what you mean by:

    The first is to access it with a localIpAdress address. (e.g. 192.168.xxx.xxx)

    please?

  5. yamachu commented on Jun 18, 2024

    @yamachu
    Contributor

    John Reilly (@johnnyreilly)

    Normally when you are developing an application using the SWA CLI, you would access the web front application by accessing http://127.0.0.1:8082 or http://localhost:8082

    Instead, you access it by typing the localIp address(private ip address?) in the address bar of your browser within the network to which the machine you are currently serving is part of (you can see this address in ifconfig, etc.).

  6. johnnyreilly commented on Jun 18, 2024

    @johnnyreilly

    Ah I see - so this would not be something that you could commit to source control as it would be potentially different for each user.

    Incidentally I can reproduce this with 1.1.9 also.

  7. bzbetty commented on Jun 18, 2024

    @bzbetty

    Highly recommend using patch-package (https://www.npmjs.com/package/patch-package) on this project at this point.

    Lets you do little tweaks like the above PR and check it into source control so any developer on the team can benefit.

  8. adrianhall commented on Jun 28, 2024

    @adrianhall

    We've released version 1.1.10 recently that explicitly has Node 20 support. Please let us know if you are still having problems.

    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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