connectkit: [BUG] connectkit (wagmi) is spamming alchemy
connectkit is sending so many requests to alchemy that it sometimes exceeds concurrent requests limit.
You can easily recreate this by going into https://docs.family.co/connectkit/try-it-out and clicking connect, and going in and out of modals several times.
{"jsonrpc":"2.0","id":42,"error":{"code":429,"message":"Your app has exceeded its concurrent requests capacity. If you have retries enabled, you can safely ignore this message. If not, check out https://docs.alchemyapi.io/documentation/rate-limits. Reach out to us if you'd like to increase your limits: https://dashboard.alchemyapi.io/support"}}
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (4 by maintainers)
Commits related to this issue
- update: siwe theme colours (#33) — committed to family/connectkit by lochie 2 years ago
If you are using NextJS, try naming your env variables as for example NEXT_PUBLIC_ALCHEMY_ID instead of just ALCHEMY_ID.
Hey everyone, I have some answers that will hopefully provide some help:
Solutions
NEXT_PUBLIC_prefix, while create-react-app requires theREACT_APP_prefix), you can test byconsole.loging out your env variables to double check that it’s being returned correctly.localhost!)Why the 429 error
If your Infura/Alchemy key has not been passed through to the
WagmiClient(or ourgetDefaultClient) correctly then wagmi will fall back to an Alchemy provider that uses a shared public API key, in which has been severly rate limited (the 429 error).If you have updated to wagmi
0.7.xyou may have noticed the 429 errors going away. The reason behind this is because this version of wagmi uses a different fallback API key, which although is also rate limited, not as many projects are using this version of wagmi – so at this point in time the new public wagmi key succeeds more often than the older version.Why the spamming
When Alchemy fails to receive data (i.e the 429 error) it has an auto-retry method baked into it. This auto-retry pings the API a few times a second until it receives data, which explains the spamming. A valid API key supplied to the client configuration will stop this issue.
Further debugging
You can check your apps client configurations by using the useProvider hook and looking at the
providerConfigsarray to see what configured providers are available.If you don’t see your provider and API key in here then there may be a different issue with your client configuration. Feel free to open a ticket if this occurs.
I hope this helps resolve everyones issues. There’s also some conversations relating to this issue in https://github.com/family/connectkit/issues/36 if anyone else wants some further reading.
hi @jterskine doing this configuration
Having same issue, even with NEXT_PUBLIC_ALCHEMY_ID
I had the same issue with Next.js + wagmi + RainbowKit after updating packages to latest versions. Despite providing my own
apiKeyviaprocess.env.NEXT_PUBLIC_and explicitly,alchemyProviderkept falling back to default publicapiKey. The fix was to revert back a few versions on wagmi to 0.5.0 and RainbowKit to 0.4.0Closing this issue as we believe this isn’t an issue with ConnectKit, but rather how Alchemy handles fallbacks.
If you are having issues please read this comment to help resolve potential setup issues. If you are still having issues feel free to open a new ticket with an reproducible example to help us debug.
I’m having the same issue. Using wagmi and clicking and Alchemy and having same error