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 21 forks source link

Account creation fails #120

Closed tifrel closed 2 years ago

tifrel commented 2 years ago

Currently, doing the following fails:

npx near-workspaces-init
cd near-workspaces
npm install
npm test -- --verbose

Output:

> test
> near-workspaces-ava "--verbose"

  ✖ Timed out while running tests

  3 tests were pending in __tests__/main.ava.ts

  ◌ root sets status
  ◌ statuses initialized in Workspace.init
  ◌ extra goodies

  ─

Digging into it, I found out that account creation failed:

import { Workspace } from "near-workspaces-ava";

const workspace = Workspace.init(async ({ root }) => {
  console.log("entering init");
  const alice = await root.createAccount("alice");
  console.log("alice created");
  return { alice };
});

workspace.test("dummy test", async (test, {}) => {
  console.log("entering test");
  test.pass();
  console.log("test passed");
});

Which gives the following output from npm test -- --verbose:

> test
> near-workspaces-ava "--verbose"

entering init

  ✖ Timed out while running tests

  1 tests were pending in __tests__/main.ava.ts

  ◌ root sets status

  ─

In other words, the account creation promise never resolves.

willemneal commented 2 years ago

Try running with NEAR_WORKSPACES_DEBUG=true it should provide more information about the issue.

tifrel commented 2 years ago

Try running with NEAR_WORKSPACES_DEBUG=true it should provide more information about the issue.

Thanks for the idea. Adding this variable magically fixed the promise resolution, now I cannot even reproduce in a fresh repo. Unfortunately, I cannot reproduce it anymore right now. If this happens to anyone else: My digging ended when querying the RpcJsonProvider for account access keys (in module near-api-js), which would never resolve.

willemneal commented 2 years ago

This might fix the issue: #112