near / near-workspaces-js

Write tests once, run them both on NEAR TestNet and a controlled NEAR Sandbox local environment
https://near.github.io/near-workspaces-js/
GNU General Public License v3.0
42 stars 22 forks source link

bug: force ipv4 instead of localhost #200

Open no2chem opened 1 year ago

no2chem commented 1 year ago

This PR fixes an issue in Node 18+ which causes tests to never launch.

The root cause is in https://github.com/nodejs/node/issues/40702 - essentially localhost is ambiguously defined as both 127.0.0.1 and ::1. Node 16 forced 127.0.0.1, whereas node 18+ just uses whatever the OS gives back as a result of getaddrinfo(3) -- on macOS it happens to be ::1 -- but the near sandbox is set to explicitly listen on ipv4 (0.0.0.0:random port).

So, this PR fixes the issue by forcing 127.0.0.1 instead of localhost for the sandbox RPC.

This PR closes #168

idea404 commented 1 year ago

I'd suggest adding these node versions to the CI in tests-sandbox.yml to assert this feature

no2chem commented 1 year ago

@idea404 done

ailisp commented 1 year ago

@volovyks I don't have permissions either, let me ask Arthur

robdefeo commented 1 year ago

Please can this be merged and released, I spent a long time getting stuck and this looks like it's the solution. I'm sure there are many others using Mac and LTS node

volovyks commented 1 year ago

@robdefeo for some reason I can not run CI here. Created a separate PR to test Node 18, but faced a dependencie issue that is not fixed here aswell. https://github.com/near/workspaces-js/pull/208

Error:

eslint-import-resolver-webpack@0.13.1: The engine "node" is incompatible with this module. Expected version "^16 || ^15 || ^14 || ^13 || ^12 || ^11 || ^10 || ^9 || ^8 || ^7 || ^6". Got "18.7.0"
error Found incompatible module.

Do you have the same issue?

robdefeo commented 1 year ago

Not sure of the exact cause though I'd suggest upgrading the version of xo. In package json is a bit old "^0.44.0" where as the current version which appears circa 2 years old. Version [0.53.1](https://www.npmjs.com/package/xo/v/0.53.1) is the latest which may have some updates. If this doesn't work then it warrants a further look.

volovyks commented 1 year ago

Hey @no2chem ! Looks like we fixed the CI, can you please merge current "main" to your branch?

no2chem commented 1 year ago

hi @volovyks - sorry for the delay. rebased and pushed.

gagdiez commented 5 months ago

all tests are passing, the change is clear, this LGTM @fospring