Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run on Node.js 17.9.0/18.2.0 #168

Closed
itegulov opened this issue May 23, 2022 · 5 comments · Fixed by #200
Closed

Unable to run on Node.js 17.9.0/18.2.0 #168

itegulov opened this issue May 23, 2022 · 5 comments · Fixed by #200

Comments

@itegulov
Copy link

itegulov commented May 23, 2022

If you install node 17.9.0/18.2.0 (using nvm or through other means) and run yarn test in the workspaces-js root directory all tests will fail with the following error:

Rejected promise returned by test. Reason:

Error (TypedError)

{ context: undefined, type: 'RetriesExceeded', message: 'Exceeded 10 attempts for http://localhost:1026.', }

› Object.fetchJson (node_modules/near-api-js/lib/utils/web.js:47:15)
› async node_modules/near-api-js/lib/providers/json-rpc-provider.js:312:34
› async Object.exponentialBackoff [as default] (node_modules/near-api-js/lib/utils/exponential-backoff.js:7:24)
› async JsonRpcProvider.sendJsonRpc (node_modules/near-api-js/lib/providers/json-rpc-provider.js:304:26)
› async JsonRpcProvider.query (node_modules/near-api-js/lib/providers/json-rpc-provider.js:116:22)
› async Account.findAccessKey (node_modules/near-api-js/lib/account.js:186:31)
› async Account.signTransaction (node_modules/near-api-js/lib/account.js:91:31)
› async node_modules/near-api-js/lib/account.js:118:34
› async Object.exponentialBackoff [as default] (node_modules/near-api-js/lib/utils/exponential-backoff.js:7:24)
› async Account.signAndSendTransactionV2 (node_modules/near-api-js/lib/account.js:117:24)

The last Node.js that works for me is 16.15.0

@idea404
Copy link

idea404 commented Jul 28, 2022

This also has memory leakage as a side effect:

image

To replicate: use Node v18.6, attempt to run workspaces-js tests for https://github.com/near-examples/FT

@ad0ll
Copy link

ad0ll commented Sep 27, 2022

I'm encountering a similar issue when trying to run integration tests from create-near-app.

  • Node 18.9.1 will never complete, instead starts accumulating memory usage until it gets killed.
  • Node 16.17.1 works without issue

Sample code that results in a kill Node 18:

import anyTest, { TestFn } from 'ava';
import * as path from "path";

const test = anyTest as TestFn<{
  worker: Worker;
  accounts: Record<string, NearAccount>;
}>;

test( "create sub-account", async (t) => {
  const worker = await Worker.init();
  const root = worker.rootAccount;
  // Hangs on this line w/ Node 18. Also hangs on deploy contract and others.
  const contract = await root.createSubAccount("test-account");
  t.context.worker = worker;
  t.context.accounts = { root, contract };
});

@no2chem
Copy link
Contributor

no2chem commented Oct 26, 2022

This bug turns out to be due to an issue with node name resolution in Node18. I'll push a PR which addresses it.

@gagdiez
Copy link
Contributor

gagdiez commented Mar 23, 2023

@volovyks @ailisp we have come across this same issue today using node 19.8.0.

@ghost
Copy link

ghost commented Mar 23, 2023

This issue is affecting at least the example repos referenced by https://docs.near.org/develop/quickstart-guide , whose integration tests uses workspaces-js

Exact line it's getting stuck is:

For those who are new to node.js/ javascript/typescript, a temporary workaround is to downgrade node:

First, install nvm

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
export NVM_DIR="$HOME/.nvm" 
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm --version # Verify installation

Then, downgrade node

nvm install v16.17.1
nvm use v16.17.1

Now, integration tests will run fine with downgraded node.

git clone https://github.com/near-examples/hello-near-rust
cd  hello-near-rust
npm install
npm run test:integration

@github-project-automation github-project-automation bot moved this to Backlog 🥶 in DevRel Jun 3, 2024
@frol frol closed this as completed in #200 Sep 3, 2024
@github-project-automation github-project-automation bot moved this from Backlog 🥶 to Shipped 🚀 in DevRel Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants