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

Access keys not observed on node - only from GCP deployment when creating account. #11918

Closed
tifrel opened this issue Aug 9, 2024 · 1 comment

Comments

@tifrel
Copy link

tifrel commented Aug 9, 2024

Describe the bug
We have this code (behind an Express server deployed to GCP):

import BN from 'bn.js';
import { Account } from '@near-js/accounts';
import { KeyPair } from '@near-js/crypto';
import { InMemoryKeyStore } from '@near-js/keystores';
import { JsonRpcProvider } from '@near-js/providers';
import { InMemorySigner } from '@near-js/signers';

const accountId = process.env.ACCOUNT_ID;
const secretKey = process.env.SECRET_KEY;

const keyStore = new InMemoryKeystore();
const keyPair = KeyPair.fromString(secretKey);
keyStore.setKey('mainnet', accountId, keyPair);
const account = new Account({
  networkId: 'mainnet',
  provider: new JsonRpcProvider({ url: 'https://rpc.mainnet.near.org'}),
  signer: InMemorySigner(keyStore),
  jsvmAccountId: ''
}, accountId);

await account.createAccount({
  `a.${accountId}`,
  keyPair.getPublicKey().toString(),
  new BN('0');
});

Yielding this error:

[-32000] Server error: Access key for public key ed25519:4dJaDkrAS2pM2G22i7hFpDKHqE7bQDpM4d9EwpeTcJHy has never been observed on the node

Note that this only happens when the code is run on GCP, not when running locally. Also, querying the RPC from localhost or from GCP does yield that the key is in fact attached to the account (pay-master.near).

To Reproduce
See code above, though it could not yet be reproduced by a third party. If necessary, we can set up a more elaborate example.

Expected behavior
I expect the account to be created without errors.

Version (please complete the following information):
Not applicable, as this relates to using NEAR RPC.

@telezhnaya
Copy link
Contributor

It looks like configuration/deployment issue, I don't think we can fix it on the nearcore side

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants