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

yarn + latest wallet selector + latest near-api-js == error #1366

Open
2 of 4 tasks
gagdiez opened this issue Jul 30, 2024 · 6 comments
Open
2 of 4 tasks

yarn + latest wallet selector + latest near-api-js == error #1366

gagdiez opened this issue Jul 30, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@gagdiez
Copy link
Contributor

gagdiez commented Jul 30, 2024

Prerequisites

  • I'm using the latest version of near-api-js.
  • I have tried to start with a fresh project and reproduce the defect with minimal code changes.
  • I have read the console error messages carefully (if applicable).

Description

Multiple people is reporting that some of our examples have stopped working when using the latest version of near-api-js and wallet-selector.

Reproducible demo

https://github.com/near-examples/guest-book-examples/tree/main/frontend

Steps to reproduce

  1. Fork the repo
  2. use yarn install on the frontend
  3. use yarn dev
  4. try to post a message without attaching NEAR

Expected behavior

A transaction saving the message should be triggered, and thus the message saved

Actual behavior

Unhandled Runtime Error

Error: Expected string not undefined(undefined) at value.signerId
Call Stack
expect_type
node_modules/borsh/lib/cjs/utils.js (34:1)
BorshSerializer.prototype.encode_string
node_modules/borsh/lib/cjs/serialize.js (85:1)
BorshSerializer.prototype.encode_value
node_modules/borsh/lib/cjs/serialize.js (45:1)
BorshSerializer.prototype.encode_struct
node_modules/borsh/lib/cjs/serialize.js (180:1)
BorshSerializer.prototype.encode_value
node_modules/borsh/lib/cjs/serialize.js (61:1)
BorshSerializer.prototype.encode
node_modules/borsh/lib/cjs/serialize.js (37:1)
serialize
node_modules/borsh/lib/cjs/index.js (35:1)
encodeTransaction
node_modules/@near-js/providers/node_modules/@near-js/transactions/lib/schema.js (35:1)
sendTransactionUntil/<
node_modules/@near-js/providers/lib/json-rpc-provider.js (81:1)
__awaiter</<
node_modules/@near-js/providers/lib/json-rpc-provider.js (8:1)
__awaiter<
node_modules/@near-js/providers/lib/json-rpc-provider.js (4:1)
sendTransactionUntil
node_modules/@near-js/providers/lib/json-rpc-provider.js (80:1)
sendTransaction/<
node_modules/@near-js/providers/lib/json-rpc-provider.js (93:1)
__awaiter</<
node_modules/@near-js/providers/lib/json-rpc-provider.js (8:1)
__awaiter<
node_modules/@near-js/providers/lib/json-rpc-provider.js (4:1)
sendTransaction
node_modules/@near-js/providers/lib/json-rpc-provider.js (92:1)
signAndSendTransaction/</result</<
node_modules/@near-js/wallet-account/node_modules/@near-js/accounts/lib/account.js (89:1)
fulfilled
node_modules/@near-js/wallet-account/node_modules/@near-js/accounts/lib/account.js (5:43)

Your environment

  • NEAR JavaScript API version used: 4.0.3
  • Frontend framework (if applicable): NextJS
  • Relevant dependencies (if applicable): "@near-wallet-selector/core": "^8.9.11",

Self-service

  • I'd be willing to fix this bug myself.
@gagdiez gagdiez added the bug Something isn't working label Jul 30, 2024
@github-project-automation github-project-automation bot moved this to NEW❗ in DevRel Jul 30, 2024
@jaswinder6991
Copy link

Just to add onto this, the issue is seen only while using yarn, I have not seen it when using npm or pnpm.
Maybe that's a good place to start looking into it.

@kujtimprenku
Copy link

A potential fix https://t.me/neardev/53025 , the idea is to remove NAJ yarn remove near-api-js and then install it again yarn add [email protected] in wallet-selector project.

Somehow yarn.lock there contains some wrong versions of dependencies this should fix them.

Node v22.5.1
Yarn v1.22.19

@pivanov
Copy link

pivanov commented Jul 31, 2024

Hey guys,
the issue is related to here-wallet because @here-wallet/[email protected] use [email protected].
I will try to find a solution asap.
Thanks for provided info ... helped me a lot.

@pivanov
Copy link

pivanov commented Jul 31, 2024

few more:

@pivanov
Copy link

pivanov commented Jul 31, 2024

#1154 fix @peersyst/near-mobile-signer 🚀

@pivanov
Copy link

pivanov commented Jul 31, 2024

If you are using @near-wallet-selector/here-wallet, the workaround could be to specifically set these resolutions or overrides to ensure compatibility with near-api-js@^4.0.0.

This approach forces the usage of the newer version of near-api-js throughout your project.

However, please note that this is a temporary workaround and not an ideal long-term solution.

For npm, you can use overrides in your package.json like this:

"overrides": {
  "near-api-js": "^4.0.0"
}

For Yarn, you can use resolutions in your package.json like this:

"resolutions": {
  "near-api-js": "^4.0.0"
}

Hope this help.

@thisisjoshford thisisjoshford removed this from DevRel Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants