solana-labs / solana-web3.js

Solana JavaScript SDK
https://solana-labs.github.io/solana-web3.js
MIT License
2.2k stars 875 forks source link

Error connecting to Phantom wallet on Chrome, using standard npx create-solana-dapp App (obscure error) #3278

Closed geoshak closed 1 month ago

geoshak commented 1 month ago

As reported on issue #3267, the @solana/web3.js will report an obscure error when trying to connect to Phantom on Chrome.

I have no idea where the issue is.

Could someone from the team at least test it out? Figure out what is failing, maybe update the error message to something meaningful?

For sure the error log could be clearer on @solana/web3.js side.

Originally posted by @steveluscher in https://github.com/solana-labs/solana-web3.js/issues/3267#issuecomment-2371870245

steveluscher commented 1 month ago

This was the stacktrace you provided:

GOT ERROR Gt: Unexpected error
    at #o (chrome-extension://bfnaelmomeimhlpmgjnjophhpkkoljpa/solana.js:3:232626)
    at async r.connect (chrome-extension://bfnaelmomeimhlpmgjnjophhpkkoljpa/solana.js:3:233501)
    at async #l [as connect] (chrome-extension://bfnaelmomeimhlpmgjnjophhpkkoljpa/solana.js:3:239256)
    at async StandardWalletAdapter._StandardWalletAdapter_connect (webpack-internal:///(app-pages-browser)/../node_modules/@solana/wallet-standard-wallet-adapter-base/lib/esm/adapter.js:242:17)
    at async eval (webpack-internal:///(app-pages-browser)/../node_modules/@solana/wallet-adapter-react/lib/esm/WalletProvider.js:104:21)
    at async eval (webpack-internal:///(app-pages-browser)/../node_modules/@solana/wallet-adapter-react/lib/esm/WalletProviderBase.js:143:17)

The error is thrown from here:

    at #o (chrome-extension://bfnaelmomeimhlpmgjnjophhpkkoljpa/solana.js:3:232626)

None of the functions in the stacktrace are from @solana/web3.js as far as I can tell, and I don't know what is happening #o.

Never the less, I tried your repro: npx create-solana-dapp. I was able to launch the resultant dapp and connect my Phantom wallet in Brave.

Pull on this thread and see if you can get results: https://stackoverflow.com/questions/53939205/how-to-avoid-extension-context-invalidated-errors-when-messaging-after-an-exte

geoshak commented 1 month ago

Thanks!

github-actions[bot] commented 1 month ago

Because there has been no activity on this issue for 7 days since it was closed, it has been automatically locked. Please open a new issue if it requires a follow up.