Key not found issue when using dev-deploy
bucanero opened this issue ยท 13 comments
Describe the bug
We've got feedback from a few devs having issues with dev-deploy
. (Notes from @doriancrutcher ๐ )
When they run yarn dev
from create-near-app
there's this error:
Error: Can not sign transactions for account dev-1634847735013-6188886 on network testnet, no matching key pair found in InMemorySigner(MergeKeyStore(UnencryptedFileSystemKeyStore(/Users/doriankinoocrutcher/.near-credentials),
running near dev-deploy -f
and then yarn dev
seems to work
To Reproduce
Steps to reproduce the behavior:
-
ran
npx create-near-app --frontend=react app-name
-
ran
yarn
for good measure -
ran
yarn dev
to try and start the prebuilt example application which in turn compiles the contract and then runsnear dev-deploy
gives me the new account in this instance dev-1634854738905-7133674
and then returns the same error
- for funzies I run
yarn start
which returns the same error
then to make it work
- I run
near dev-deploy -f
which creates another new dev account
and deploys the contract onto there
- then I run
yarn start
and it works
Expected behavior
In the past, I would just run yarn && yarn start
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: [e.g. MacOS]
- Version [e.g. 22]
Additional context
Add any other context about the problem here.
User @NarkomDe submitted a script to catch a problem with missing keys: https://gist.github.com/NarkomDe/06d8198147224c68bfd391c25217e999.
To run you'd need a near-api-js
and set process.env.NEAR_ACCOUNT
to an account you have on testnet. It had run successfully for 27 iterations and I've got Can not sign transactions for account on network testnet, no matching key pair found in InMemorySigner
on a 28-th iteration.
My guess is that it's connected to this: near/near-workspaces-js#95
My guess is that it's connected to this: near/workspaces-js#95
thank you @willemneal for the feedback. So once that PR is merged, this issue should be fixed, right?
Nope, that just fixes the workspace package. Previously generated a cached testnet account that was 14 chars. I was able to do a dev deploy with near-cli as it generated a accountId that was 33 long. So my guess is the version of near-cli is old? It worked for me on 2.1.1
I created a project using this boilerplate: https://github.com/Learn-NEAR/starter--near-sdk-as
While firing near dev-deploy <wasm-file>
after compiling, I am still getting the same error as @bucanero :
Error: Can not sign transactions for account dev-1634847735013-6188886 on network testnet, no matching key pair found in InMemorySigner(MergeKeyStore(UnencryptedFileSystemKeyStore(/Users/doriankinoocrutcher/.near-credentials),
But sometimes it works. Like after 3-4 tries. It's random.
near-cli version: 2.2.0
I would try updating your near-cli
I would try updating your
near-cli
It seems near v2.2.0 is the latest version.
I already have it. I am on ubuntu system.
This issue is same for my colleagues as well. They are on Mac Os and Mint.
@SahilVasava please, make sure that you are not using a local (outdated) version of the cli. Check it with which near
.
Also, try deleting the neardev
folder and then running the command again.
Please, tell me if the issue is still present after this.
@volovyk-s Hey I am sure I am using the latest version. Checked with which near
as well. Same v2.2.0
.
And I have tried deleting neardev
folder. Infact I do it everytime my dev-deploy
script runs.
I created a project using this boilerplate: https://github.com/Learn-NEAR/starter--near-sdk-as While firing
near dev-deploy <wasm-file>
after compiling, I am still getting the same error as @bucanero :Error: Can not sign transactions for account dev-1634847735013-6188886 on network testnet, no matching key pair found in InMemorySigner(MergeKeyStore(UnencryptedFileSystemKeyStore(/Users/doriankinoocrutcher/.near-credentials),
But sometimes it works. Like after 3-4 tries. It's random.near-cli version: 2.2.0
The user name in this error is doriankinoocrutcher
. Can you please provide the error from your PC? Maybe we will find additional info there.
The user name in this error is
doriankinoocrutcher
. Can you please provide the error from your PC? Maybe we will find additional info there.
Sure, although it's exactly same in my case. Here's it is:
Starting deployment. Account id: dev-1637750896429-89085746887074, node: https://rpc.testnet.near.org, helper: https://helper.testnet.near.org, file: ./build/release/ngo.wasm An error occured Error: Can not sign transactions for account dev-1637750896429-89085746887074 on network testnet, no matching key pair found in InMemorySigner(MergeKeyStore(UnencryptedFileSystemKeyStore(/root/.near-credentials), UnencryptedFileSystemKeyStore(/app/neardev))). at Account.signTransaction (/usr/local/share/.config/yarn/global/node_modules/near-api-js/lib/account.js:93:19) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async /usr/local/share/.config/yarn/global/node_modules/near-api-js/lib/account.js:118:34 at async Object.exponentialBackoff [as default] (/usr/local/share/.config/yarn/global/node_modules/near-api-js/lib/utils/exponential-backoff.js:7:24) at async Account.signAndSendTransactionV2 (/usr/local/share/.config/yarn/global/node_modules/near-api-js/lib/account.js:117:24) at async devDeploy (/usr/local/share/.config/yarn/global/node_modules/near-cli/commands/dev-deploy.js:53:20) at async Object.handler (/usr/local/share/.config/yarn/global/node_modules/near-cli/utils/exit-on-error.js:52:9) TypedError: Can not sign transactions for account dev-1637750896429-89085746887074 on network testnet, no matching key pair found in InMemorySigner(MergeKeyStore(UnencryptedFileSystemKeyStore(/root/.near-credentials), UnencryptedFileSystemKeyStore(/app/neardev))). at Account.signTransaction (/usr/local/share/.config/yarn/global/node_modules/near-api-js/lib/account.js:93:19) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async /usr/local/share/.config/yarn/global/node_modules/near-api-js/lib/account.js:118:34 at async Object.exponentialBackoff [as default] (/usr/local/share/.config/yarn/global/node_modules/near-api-js/lib/utils/exponential-backoff.js:7:24) at async Account.signAndSendTransactionV2 (/usr/local/share/.config/yarn/global/node_modules/near-api-js/lib/account.js:117:24) at async devDeploy (/usr/local/share/.config/yarn/global/node_modules/near-cli/commands/dev-deploy.js:53:20) at async Object.handler (/usr/local/share/.config/yarn/global/node_modules/near-cli/utils/exit-on-error.js:52:9) { type: 'KeyNotFound', context: undefined }
Wierd..
Try reinstalling near-cli
please.
Also, looks like you are executing as root
, please, try to execute as a user.
This is running in a destructible docker container where near-cli
gets installed anew everytime it's created. Hence also root
.
But I have done it in my local setup as well. Same issue, tried reinstalling multiple times. Same with my colleagues. By now, I have tried it in my two machines one linux and mac with freshly installed near-cli
.
Here's a link to one of the project where it is being used, https://github.com/CreatorOS/coin-toss-game-near-mobile-version
This is the exact file where it is being used https://github.com/CreatorOS/coin-toss-game-near-mobile-version/blob/main/learn_src/scripts/1.init.sh