-
Notifications
You must be signed in to change notification settings - Fork 684
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
[bug] getDefaultConfig is not a function #1777
Comments
@nfadeluca Thanks for raising this issue! I've taken a look at your code and a few things that needs to be done to solve this issue:
Here is the final code for you to try: layout.tsx
context/index.tsx
config/index.ts
Note: You might also get some polyfill errors so make sure to have this fallback in your next.config.mjs file. Also if it's helpful please refer to our app router example here. Let me know if everything works 🙏 |
@kosmoskey Following the example fixed it, I just ended up putting everything in a context file and removing the cookies/state, thank you. |
@kosmoskey in the code you provided, importing the wagmi config inside the layout cause an error since |
|
Hi there, i'm getting this exact same error: "Error: (0 , rainbow_me_rainbowkit__WEBPACK_IMPORTED_MODULE_2_.getDefaultConfig) is not a function". I have this next.config.ts file:
Currently running these package versions:
(I plan on removing ethers, but for now still around) This is my wagmi config file:
My providers.tsx:
What am I doing wrong here? Thanks |
@radulff Can you import |
@kosmoskey I'm already doing so, sorry I didn't put it in the question. (Just updated my previous code, to make sure it appears) |
@radulff The code you provided works totally fine for me i get no errors. Could you please try following this with-next-app example we have and let me know if there is anything else missing in your project ? |
Hi there @kosmoskey, indeed it is working well in the “with-next-app” template. Sorry for the hassle. Do you have any ideas of what could the issue be on my end? How could I debug it? Thanks in advance. |
The error persist if you import |
@smauret Usually when doing The one thing you can do is follow the wagmi's cookieToInitialState for config and use that instead. Just pushed a super simple next app router example with |
@kosmoskey thanks for your answer ! That works ! So it's in the root layout that you can only pass the cookies and it's in the provider that you use |
@smauret Yeah. Maybe there is a better approach, but at least it solves the problem. |
Thanks, this example helped me |
What should I do if I want to use the wagmiConfig (derived from the rainbow helper function) on server side? It looks like the rainbowkit can only import on client side, otherwise error like this will be thrown:
|
@songkeys The same thing will happen if you use |
I should be more clear. In my case, I want to use the viem action generated by wagmi cli. Every action needs a
I'm not sure if this is true because I actually made it work - I created another |
@songkeys I see what you mean. I think wagmi has it's own CLI compatibility when it comes to server side rendering which is not supported by RainbowKit yet. Thanks for bringing that up i'll try to investigate more on this and hopefully see what we can do on our end 🙏 |
Hi @magiziz I have found an issue related to this implementation https://github.com/magiziz/rainbowkit-v2-app-router Example is that we have a If you try to use
It would fail with the following error
|
it works, thanks! @magiziz |
I had same issue in my Next.js application and after long hours of trying to fix it I noticed I left an extra whitespace in the use client flag You should probably check that too if you're having a similar issue |
Works like a charm. Many thanks! |
Is there an existing issue for this?
RainbowKit Version
2.0.0
wagmi Version
2.5.7
Current Behavior
In a next v14.0.4 project setup with wagmi 2.5.7 and rainbowkit 2.0.0.
Upon page compilation finishing, the error displays:
Expected Behavior
getDefaultConfig should work as per the docs.
Steps To Reproduce
I have a config file in /config/index.ts:
And I use it in a context provider in /context/index.ts:
And this context provider is finally used in the root layout:
Ran using npm run dev
Link to Minimal Reproducible Example (CodeSandbox, StackBlitz, etc.)
No response
Anything else?
My directory looks like so:
The text was updated successfully, but these errors were encountered: