-
Notifications
You must be signed in to change notification settings - Fork 960
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
Can't find ConnectionProvider (Wallet No Longer Works) #532
Comments
+1 |
Just spent a while trying to troubleshoot the same problem. I'm getting the following error when trying to run my nextjs app:
Same thing for other @solana/wallet-adapter libraries. Cannot find WalletProvider, ConnectionProvider, useWalletDialog... My repository can be found here: https://github.com/josip-volarevic/narentines-holders-only/tree/wallet-adapter-issue As an additional note, I've tried a few things:
My React app which is working used the following versions:
It also worked when I've updated everything to the @latest:
Nextjs app didn't work with either version set I can create a proper minimal error reproduction repository tomorrow in case somebody doesn't do it in the meantime. |
I’ve been working yesterday on both Next.js and SvelteKit (this one uses Vite instead Webpack) apps and it was working fine. This morning after updates / trying new fresh new setups none works. Tried with different packet managers too (yarn and pnpm) |
@tiagoappetite I assume your repos work with older package versions? |
Same issue |
Same issue. And these are the last versions working for me. {
"@solana/wallet-adapter-base": "0.9.13",
"@solana/wallet-adapter-react": "0.15.15",
"@solana/wallet-adapter-react-ui": "0.9.13",
"@solana/wallet-adapter-wallets": "0.17.2"
} |
i think some dependencies are causing it, if i yarn in any project that did works - it breaks |
Thanks for all the reports, I'll work on this today. First I need to isolate the issue, to see if it's reproducible within the repo, and if not, what causes it. Can you test something and tell me if it works? (I'm typing shell cmds from my phone apologies for any mistakes) --
|
@jordansexton I just ran those commands and here is the error that I get. I wonder if it has to do with some server side specific code in a dependency trying to run on the frontend in NextJS. I noticed a similar issue yesterday with @gokiprotocol/walletkit. Any chance it is coming from a dependency that both projects rely on?
|
@jordansexton following your steps (Next.js) I do get similar error:
And in case this helps, here's the issues getting on non-React frameworks that were working fine just yesterday. Both Next.js and Nuxt.js seems to suffer from a rather similar error Nuxt.js (Vue)
Svelte We can probably ignore Svelte as it seems a whole different thing and out of scope of this repo... just for reference, since it was working yesterday before those updates.
|
Curious thing I'm seeing (and seen in other comments), reverting to a prior version of wallet-adapter does not seem to resolve this issue. This makes me think that the problem is with a dependency which is set via Look through the Seems unlikely that the web3.js build itself is bad, but could possibly be a small change in usage that is cascading? |
What if you use npm overrides / yarn resolutions to force a specific pinned exact version? |
I'll be on my computer soon to fix this. Offhand, it sounds like what's going on is that this is related to an aspect of the change I made yesterday. We still ship CJS and ESM builds, but the ESM build outputs are no longer .mjs files, just .js files. Some build tools might have been broken by this change. |
Put this in real quick and ran a build, still the same issue as above. May have been a false lead. Will dig more on my end when I get back to my computer. |
The problem seems to be from the I've a build from 5 days ago with version Doing an update changes it to version Before Update
After Update
So even you specify on package.json
It still doesn't works as the wallets are requiring |
Okay, an informational update -- This fails:
This works:
The difference here is Next.js vs Parcel. My guess is that Parcel is handling imports without explicit .mjs extensions, and Next isn't. Working on configuration that will resolve this. |
Another data point -- the Next.js used to use Webpack 5, but I'm confused as to whether it does anymore. Their docs indicate it's using their Rust compiler, SWC: https://nextjs.org/docs/advanced-features/compiler However, their docs also indicate you can configure Webpack: https://nextjs.org/docs/api-reference/next.config.js/custom-webpack-config This is what I'll try next. |
Okay, so it appears the difference is that SWC is a replacement for Babel, but Webpack 5 is still used. Adding this /** @type {import('next').NextConfig} */
module.exports = {
reactStrictMode: true,
webpack(config, context) {
console.log(config.module.rules);
process.exit(1);
return config;
},
}; We get this: [
{ test: /\.m?js/, resolve: { fullySpecified: false } },
/* ... */
] This indicates Next is already configured by default to handle .js and .mjs files imported without an extension. This is good and what we'd expect, but unfortunately suggests the problem lies elsewhere. |
Curiously, this issue is also affecting |
I've just tried start a new React app with Vite... and it also worked just fine!! Which puzzles me given that Nuxt.js uses Vite and was also giving an error similar to Next.js |
It seems like this may be related to an open issue with Next.js: vercel/next.js#39375 I also tried using the TS config option, However -- I was able to fix the issue locally in a project by manually changing all the imports without extensions to So what I might need to do is change all of the imports in Wallet Adapter to do this. I'll then have to make sure this doesn't break Parcel, Webpack, etc. |
I was actually trying something similar. Those are the default TS config settings on a new React app (Vite)... tried replicate them over Next / Nuxt without any success.
|
Pretty much tried the same ts configuration with nodenext and no luck as well |
@jordansexton I opened a support ticket w/ Vercel yesterday related to this. They got back and I brought this thread to their attention. One thing they suggested which doesn't seem to be the issue, but noting in case it helps someone, specifically using Yarn 3 on Vercel:
|
Anyone know if there's an eslint rule that will change all imports to explicit .js? Wallet Adapter currently has implicit imports and also index imports so it would be great to have something that will intelligently fix these now, and also scold us if we don't use them. |
@kgilliam125 interesting, thanks for that context. Unfortunately based on the testing in this thread, this also affects projects that don't use yarn, just using npm. |
Woof. Not how I was planning on spending the day! This is fixed. Please test it out! Use these dependencies. Probably good to nuke your {
"@solana/wallet-adapter-base": "^0.9.15",
"@solana/wallet-adapter-react": "^0.15.17",
"@solana/wallet-adapter-react-ui": "^0.9.15",
"@solana/wallet-adapter-wallets": "^0.18.4",
} Unfortunately there is no good automated solution to this. Things that didn't work:
Things that did work:
|
Correction: use |
@jordansexton you are a gentleman and a scholar. Thank you so much for putting so much time into figuring this out! |
Production release going out now. |
https://twitter.com/jordaaash/status/1561540587127353344 These should work! {
"@solana/wallet-adapter-base": "^0.9.15",
"@solana/wallet-adapter-react": "^0.15.17",
"@solana/wallet-adapter-react-ui": "^0.9.15",
"@solana/wallet-adapter-wallets": "^0.18.4",
} |
It works well. Thanks @jordansexton ! |
Opening a new issue about this change and SvelteKit #541 since @tiagoappetite reported it. It is out of the scope of this project, but since some frameworks like SvelteKit are working with Vite, it would be interesting to find a solution for them. |
Fixed for CJS projects by #542 and published. |
Stopped working for me this night in all projects I've after update (React's Next.js and tried on Svelte too)
Error [ERR_MODULE_NOT_FOUND]: Cannot find module /app/node_modules/@solana/wallet-adapter-react/lib/esm/ConnectionProvider
The text was updated successfully, but these errors were encountered: