MultiversX Tracker is Live!

DEV: Dapp not recognizing Alchemy & Infura providers via wagmi.

Etherum Reddit

More / Etherum Reddit 139 Views

DEV: Dapp not recognizing Alchemy & Infura providers via wagmi.

Gm!

Having a problem with a Next.js app.

Anyone familiar with wagmi library for React know why my dapp is defaulting to the defaultProvider()? Even after removing the default from the chain configuration completely.

Browser debug doesn't seem to be properly reading my API keys from my environment variables. I've never had this problem when initializing from create-react-app, so I'm wondering if since I started from an npx create-next-app if I'm missing something. Environment variables are in .env.local in the main directory.

Here's my _app.tsx

import '../styles/globals.css'; import type { AppProps } from 'next/app'; import '@rainbow-me/rainbowkit/styles.css'; import { getDefaultWallets, RainbowKitProvider } from '@rainbow-me/rainbowkit'; import { chain, configureChains, createClient, WagmiConfig } from 'wagmi'; import { alchemyProvider } from 'wagmi/providers/alchemy'; import { infuraProvider } from 'wagmi/providers/infura'; const { chains, provider } = configureChains( [chain.mainnet], [ alchemyProvider({ apiKey: process.env.ALCHEMY_API!, }), infuraProvider({ apiKey: process.env.INFURA_API!, }), ] ); const { connectors } = getDefaultWallets({ appName: 'Testing Mint DApp', chains, }); const wagmiClient = createClient({ autoConnect: true, connectors, provider, }); function App({ Component, pageProps }: AppProps) { return ( <WagmiConfig client={wagmiClient}> <RainbowKitProvider chains={chains}> <Component {...pageProps} /> </RainbowKitProvider> </WagmiConfig> ); } export default App; 

This is the error that I'm getting on the browser side. No recognition of my API keys and then spamming the default mainnet endpoint:

Browser-side errors.

submitted by /u/SapientMeat
[link] [comments]

Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments