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

TransportRaceCondition in ledger-transport.js changed to TransportPendingOperation #950

Open
infoparth opened this issue Apr 24, 2024 · 12 comments

Comments

@infoparth
Copy link

Error: No matching export in "node_modules/@ledgerhq/errors/lib-es/index.js" for import "TransportRaceCondition"

node_modules/@solana/wallet-adapter-ledger/node_modules/@ledgerhq/hw-transport/lib-es/Transport.js:74:9:
  74 │ import { TransportRaceCondition, TransportError, StatusCodes, getAltStatusMessage, Transp...

which is causing the application to break on running "npm run dev",

because TransportRaceCondition has been updated to TransportPendingOperation, as mentioned here LedgerHQ/ledger-live@931d511

swapping TransportRaceCondition with TransportPendingOperation in the node modules worked for me, but it might break the application in production.

@jesulonimii
Copy link

Hey. noticed this issue also.
A work around I implemented was to modify the @ledgerhq/errors package from @ledgerhq/[email protected] to @ledgerhq/[email protected] in my package-lock.json. (and sha256 signature also)

So it uses the previous working version, pending the time this is resolved

@infoparth
Copy link
Author

Hey. noticed this issue also. A work around I implemented was to modify the @ledgerhq/errors package from @ledgerhq/[email protected] to @ledgerhq/[email protected] in my package-lock.json. (and sha256 signature also)

So it uses the previous working version, pending the time this is resolved

Hey @jesulonimii , thanks a lot for the help... it saved me

@wakechromium
Copy link

Hey. noticed this issue also. A work around I implemented was to modify the @ledgerhq/errors package from @ledgerhq/[email protected] to @ledgerhq/[email protected] in my package-lock.json. (and sha256 signature also)

So it uses the previous working version, pending the time this is resolved

Getting same error but enable to resolve.

@sunfkny
Copy link

sunfkny commented Apr 26, 2024

Hey. noticed this issue also. A work around I implemented was to modify the @ledgerhq/errors package from @ledgerhq/[email protected] to @ledgerhq/[email protected] in my package-lock.json. (and sha256 signature also)

So it uses the previous working version, pending the time this is resolved

@jesulonimii A better way is to add overrides in the package.json file of your project. #949

@shawalali07
Copy link

Hey. noticed this issue also. A work around I implemented was to modify the @ledgerhq/errors package from @ledgerhq/[email protected] to @ledgerhq/[email protected] in my package-lock.json. (and sha256 signature also)

So it uses the previous working version, pending the time this is resolved

Can you share the exact change here?

@mrsaifullah52
Copy link

after down grade the version it throws another error:

✘ [ERROR] No matching export in "node_modules/@ledgerhq/hw-transport/node_modules/@ledgerhq/errors/lib-es/index.js" for import "TransportPendingOperation"

    node_modules/@ledgerhq/hw-transport/lib-es/Transport.js:11:9:
      11 │ import { TransportPendingOperation, TransportError, StatusCodes, getAltStatusMessage, TransportStatusError, } from "@ledgerhq/errors";

@mcintyre94
Copy link
Collaborator

Can someone please provide source code that produces an error here?

I've updated the example app to include new LedgerWalletAdapter(), and I'm able to connect to a ledger wallet with no issues

I'd like to understand this error more before figuring out how we want to fix it here. Also note that TransportRaceCondition is not found in the source code of wallet-adapter, so I'm not sure yet where this error is coming from.

@mcintyre94
Copy link
Collaborator

mcintyre94 commented May 30, 2024

I'm going to move discussion here from #949 which is a closed PR

Thanks to https://github.com/sponge-babe we have a repro using yarn: https://github.com/sponge-babe/ledgerhq-issue

I can repro with yarn & yarn start in that repo.

If I add resolutions like this:

"resolutions": {
    "@ledgerhq/errors": "6.16.3"
},

Then there's a warning from yarn:

warning Resolution field "@ledgerhq/[email protected]" is incompatible with requested version "@ledgerhq/errors@^6.16.4"

But it does seem to resolve to 6.16.3:

"@ledgerhq/[email protected]", "@ledgerhq/errors@^6.10.0", "@ledgerhq/errors@^6.16.4":
  version "6.16.3"
  resolved "https://registry.yarnpkg.com/@ledgerhq/errors/-/errors-6.16.3.tgz#646f68cc7e6e8d5126bce1ca06140c5ad963bee8"
  integrity sha512-3w7/SJVXOPa9mpzyll7VKoKnGwDD3BzWgN1Nom8byR40DiQvOKjHX+kKQausCedTHVNBn9euzPCNsftZ9+mxfw==

But I still get the error when it starts:

ERROR in ./node_modules/@ledgerhq/hw-transport-webhid/node_modules/@ledgerhq/hw-transport/lib-es/Transport.js 242:18-43

Now if I search @ledgerhq/hw-transport in the yarn lock file it seems to be resolving two versions:

"@ledgerhq/[email protected]":
  version "6.27.1"
  resolved "https://registry.yarnpkg.com/@ledgerhq/hw-transport/-/hw-transport-6.27.1.tgz#88072278f69c279cb6569352acd4ae2fec33ace3"
  integrity sha512-hnE4/Fq1YzQI4PA1W0H8tCkI99R3UWDb3pJeZd6/Xs4Qw/q1uiQO+vNLC6KIPPhK0IajUfuI/P2jk0qWcMsuAQ==
  dependencies:
    "@ledgerhq/devices" "^6.27.1"
    "@ledgerhq/errors" "^6.10.0"
    events "^3.3.0"

"@ledgerhq/hw-transport@^6.27.1":
  version "6.30.6"
  resolved "https://registry.yarnpkg.com/@ledgerhq/hw-transport/-/hw-transport-6.30.6.tgz#c6d84672ac4828f311831998f4101ea205215a6d"
  integrity sha512-fT0Z4IywiuJuZrZE/+W0blkV5UCotDPFTYKLkKCLzYzuE6javva7D/ajRaIeR+hZ4kTmKF4EqnsmDCXwElez+w==
  dependencies:
    "@ledgerhq/devices" "^8.3.0"
    "@ledgerhq/errors" "^6.16.4"
    "@ledgerhq/logs" "^6.12.0"
    events "^3.3.0"

If I instead add the resolution:

"resolutions": {
    "@ledgerhq/hw-transport": "6.27.1"
},

Then that fixes the issue. So as a workaround for everyone seeing this, this resolution is probably the best solution.

I'm a bit stumped though, because we have that resolution:

"@ledgerhq/hw-transport": "6.27.1",

We also have that precise version as the dependency of the ledger adapter:

"@ledgerhq/hw-transport": "6.27.1",

So I'm not sure how yarn is messing this up TBH, or what we can do to fix this for you in our code. I'm not really familiar with yarn though, so would be keen to hear any ideas.

Also, has anyone seen this with any package manager other than Yarn?

@sponge-babe
Copy link

"resolutions": {
"@ledgerhq/hw-transport": "6.27.1"
},

i tried your solution in the same repo, and it didn't work. how did you make it work with:
"resolutions": { "@ledgerhq/hw-transport": "6.27.1" }

@TechTronixx
Copy link

TechTronixx commented May 30, 2024

I've managed to find a workaround fix based on previous suggestions, which is currently working with pnpm, & yarn. There are no issues with Vite either.

I'm using React v18.2.0. Adding the following seems to be working at the moment :

"resolutions": {
  "@ledgerhq/devices": "6.27.1",
  "@ledgerhq/errors": "6.16.3",
  "@ledgerhq/hw-transport": "6.27.1",
  "@ledgerhq/hw-transport-webhid": "6.27.1"
}

@sponge-babe
Copy link

sponge-babe commented May 30, 2024

I've managed to find a workaround fix based on previous suggestions, which is currently working with npm, pnpm, & yarn. There are no issues with Vite either.

I'm using React v18.2.0. Adding the following seems to be working at the moment :

"resolutions": { "@ledgerhq/devices": "6.27.1", "@ledgerhq/errors": "6.16.3", "@ledgerhq/hw-transport": "6.27.1", "@ledgerhq/hw-transport-webhid": "6.27.1" }

This solution worked! Thanks @TechTronixx

@redcomethk
Copy link

I've managed to find a workaround fix based on previous suggestions, which is currently working with npm, pnpm, & yarn. There are no issues with Vite either.

I'm using React v18.2.0. Adding the following seems to be working at the moment :

"resolutions": { "@ledgerhq/devices": "6.27.1", "@ledgerhq/errors": "6.16.3", "@ledgerhq/hw-transport": "6.27.1", "@ledgerhq/hw-transport-webhid": "6.27.1" }

It seems some small tweaking is needed for npm as "overrides" is supported instead of "resolutions"
I have added this to my package.json and it works:

"overrides": {
  "@ledgerhq/devices": "6.27.1",
  "@ledgerhq/errors": "6.16.3",
  "@ledgerhq/hw-transport": "6.27.1",
  "@ledgerhq/hw-transport-webhid": "6.27.1"
}

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

10 participants