connection.connector.getChainId is not a function #4216
Replies: 12 comments 10 replies
-
we are also running into this @Sahitya777 ... looks like a bug. did you create an issue in the wagmi repo? i'd like to upvote it if it's there... thanks. |
Beta Was this translation helpful? Give feedback.
-
hey i am also the same issues like r.connector.getChainId is not function |
Beta Was this translation helpful? Give feedback.
-
++++ having same issues as well! |
Beta Was this translation helpful? Give feedback.
-
Same issue :( |
Beta Was this translation helpful? Give feedback.
-
same issue |
Beta Was this translation helpful? Give feedback.
-
Has anyone been able to resolve this? @Sahitya777 |
Beta Was this translation helpful? Give feedback.
-
It seems to come from when there is a divergence between the config used by the Wagmi wrapper component, and the config used by transactions (readContract, writeContract). |
Beta Was this translation helpful? Give feedback.
-
I had this issue but it seems to be due to the browser wallet silently signing me out of my account, not a wagmi misconfiguration. Once the sign out happens, wagmi starts throwing this error. I suspect that metamask just changed their sign-out delay and now this is happening to many users. |
Beta Was this translation helpful? Give feedback.
-
I had the same error and I solved it with the following code:
U have to wait until connection will be ready in order to sign messages or use custom hooks |
Beta Was this translation helpful? Give feedback.
-
For me, the wagmi config used to be inside the provider component. Moving it outside fixed this |
Beta Was this translation helpful? Give feedback.
-
any update? |
Beta Was this translation helpful? Give feedback.
-
import { http, defineChain } from 'viem'
import { createConfig } from 'wagmi'
import { bsc, bscTestnet } from 'wagmi/chains'
//custom define Chain
const bscTest = defineChain({
id: 97,
name: 'BNB Smart Chain Testnet',
nativeCurrency: { name: 'BNB', symbol: 'BNB', decimals: 18 },
rpcUrls: {
default: {
http: ['https://bsc-testnet-dataseed.bnbchain.org/'],
},
},
blockExplorers: {
default: {
name: 'BNB Smart Chain Testnet',
url: 'https://testnet.bscscan.com/',
apiUrl: 'https://api-testnet.bscscan.com/api',
},
},
})
export const config = createConfig({
chains: [
bscTest,
bscTestnet,
{
...bsc,
rpcUrls: {
default: { http: ['https://bsc-dataseed3.bnbchain.org/'] },
},
},
],
transports: {
[bscTest.id]: http(),
[bscTestnet.id]: http(),
[bsc.id]: http(),
},
ssr: true,
})
<WagmiWeb3ConfigProvider config={config} chains={[bsc, bscTestnet, bscTest]} .... />
i solve it with chain from 'wagmi/chains' , you must put chains in provider to not got error "Not found chain" |
Beta Was this translation helpful? Give feedback.
-
So the issue is that I have one base route in my application as /v1 where I have a modal for wallet connects and when the user connects the wallet I send him to other route like /home where the wallet stays connected by connectWagmi({ connector:wagmiConnectors[0] })
But the thing is If i refresh the page the write calls start to fail and give error of connection.connector.getChainId is not a function Idk why it is happening
This is my config
const config = createConfig(
getDefaultConfig({
// Your dApps chains
chains: [baseSepolia],
transports: {
// RPC URL for each chain
[baseSepolia.id]: http(
),
},
);
Beta Was this translation helpful? Give feedback.
All reactions