Rabby
Rabby copied to clipboard
Wagmi: 'connection.connector.getProvider is not a function'
With some sites that use Wagmi hooks, the calls to hook will fail with connection.connector.getProvider is not a function'
, only while using Rabby wallet.
Describe the bug
Periodically, all functions from hooks (e.g. connect, writeContract / writeContractAsync) fails with connection.connector.getProvider is not a function.
Refreshing page fixes it.
It only occurs with Rabby wallet, Metamask stays connected always and does not run into the issue.
Link to Minimal Reproducible Example
No response
Steps To Reproduce
Nextjs 13+ SSR configured
wagmiConfig.ts
export const wagmiConfig = createConfig({
// Setup chains
chains: chains,
transports: {
[mainnet.id]: http(),
[goerli.id]: http(),
[sepolia.id]: http(),
[holesky.id]: http()
},
// Enable SSR support (needs cookies)
ssr: true,
storage: createStorage({
storage: cookieStorage
}),
connectors: [injected()]
});
Web3Provider.tsx
'use client';
// ...
const queryClient = new QueryClient();
const Web3Provider = ({
children,
initialState
}: {
children: React.ReactNode;
initialState: State;
}) => {
return (
<>
<WagmiProvider config={wagmiConfig} initialState={initialState}>
<QueryClientProvider client={queryClient}> {children}</QueryClientProvider>
</WagmiProvider>
</>
);
};
layout.tsx
// ...
const initialState = cookieToInitialState(wagmiConfig, headers().get('cookie'));
This may also be relevant: I do not use any 3rd party connector (e.g. ConnectKit, Web3Modal, etc). I just do a simple:
'use client';
// ...
const { connectors, connect } = useConnect();
if (!isWalletConnected) {
try {
connect({ connector: connectors[0] });
} catch (e) {
// ...
}
}
Wagmi Version
2.3.1
Viem Version
2.4.0
TypeScript Version
10.9.1
Check existing issues
- [X] I checked there isn't already an issue for the bug I encountered.
Anything else?
I think it would be really helpful to know more about how connection.connector.getProvider
could occur from a dev perspective, e.g. what is going on. Then we can narrow down why it doesn't work with Rabby.
Looks like issue with wagmi, can you check with wagmi team first?