Connection declined. Connection can be declined if a previous request is still active
Discussed in https://github.com/orgs/WalletConnect/discussions/4310
Originally posted by Ay7ot March 9, 2024 This is my first time working with Web3Modal and I'm using react. I'm running into a kind of bug. When Itry to connect from a mobile browser or a browser that doesn't have an extension installed, i get the error Connection declined. Connection can be declined if a previous request is still active. My Context provider code looks like this: `import { createWeb3Modal } from '@web3modal/wagmi/react' import { defaultWagmiConfig } from '@web3modal/wagmi/react/config' import { injected, metaMask, safe, walletConnect } from 'wagmi/connectors' import { WagmiProvider } from 'wagmi' import { arbitrum, mainnet } from 'wagmi/chains' import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
// 0. Setup queryClient const queryClient = new QueryClient()
// 1. Get projectId at https://cloud.walletconnect.com const projectId = 'MY_PROJECT_ID'
// 2. Create wagmiConfig const metadata = { name: 'Web3Modal', description: 'Web3Modal Example', url: 'http://localhost:5173', // origin must match your domain & subdomain icons: ['https://avatars.githubusercontent.com/u/37784886'] }
const chains = [mainnet, arbitrum] const config = defaultWagmiConfig({ chains, // required projectId, // required metadata, // required
enableWalletConnect: true, // Optional - true by default
enableInjected: true, // Optional - true by default
enableEIP6963: true, // Optional - true by default
enableCoinbase: true, // Optional - true by default
})
// 3. Create modal createWeb3Modal({ wagmiConfig: config, projectId, enableAnalytics: true // Optional - defaults to your Cloud configuration })
export function ContextProvider({ children }) { return ( <WagmiProvider config={config}> <QueryClientProvider client={queryClient}>{children}</QueryClientProvider> </WagmiProvider> ) }`
I basically followed the doc on installation and I dont know why this is happening. My button is in my app folder and yes, i wrapped my App in ContextProvider.
Any update on this? Currently experiencing the same error.
Having this same issue
Literally dealing with same thing right now. I have no connection windows open or anything.
I'm also facing the same problem.
We are on the same league. Waiting hero to come now.
Over 1 month later, I'm experience this issue. Any updates?
Still active.
still this issue is there ? 💔
Oh mine. I am facing this right now.
Well, OK. I think I should
- just show "Account" modal, since the error message. says "previous request is still active",
- or call wagmi
disconnect()then show thisconnectmodal.
Cool!
Had to subscribe to this as facing similar issues
This error just hit me this morning, any updates please??
also got this issue today
I'm facing the same problem too. Looking forward to a good solution
Same here, "Connection Declined - Connection can be declined if a previous request is still active".
Impossible to connect from our Expo app on both Wagmi and Ethers.
I'm also facing this problem. I'm using Vue, ethers, and reown.
I'm also this problem. usign Nextjs, wagmi, viem and reown.
为什么这个插件ios18版本以下不能链接钱包,这个要怎么改
Why can't this plugin link to wallets below iOS 18 version? How can I change this
- [x] Same problem here. If they don't fix it, I will switch to another service to meet deadline.
I had to update the package to 1.2.0 and all problems disappeared. Thanks for fixing it in 1.1.8.
- [x] Same problem here. If they don't fix it, I will switch to another service to meet deadline.
I had to update the package to
1.2.0and all problems disappeared. Thanks for fixing it in 1.1.8.
BTW @reown/appkit-adapter-wagmi must be updated too
Facing same issue on mobile when accessing through browser.I tried with both version 1.2.0 and 1.1.8 and updated "reown/appkit" ,"reown/appkit-adapter-wagmi" both to same version but still not working
The initial issue is too old ... can someone share a minimal reproducible example, share a video or give us more context to we can repro it !
Thanks :)
The initial issue is too old ... can someone share a minimal reproducible example, share a video or give us more context to we can repro it !
Thanks :)
I am having the same issue on mobile when trying to connect from "Browser Wallet" in the modal. If I choose the specific wallet from the other wallets option it connects successfully, but Metamask is not present there so users using Metamask should use the embedded browser inside metamask. I am literally using the same config as in the example repo https://github.com/reown-com/appkit/tree/main/examples/next-wagmi-app-router
I have connected the phone to the pc so as to inspect the console via Chrome but there were no errors.
The OS of the phone doesn't matter, happening on Android and iOS
All the other functionalities work (Connections via PC, from "All Wallets" option also I have tried a couple of wallets such as Zerion and it's working) I have also tried from mobile Brave Browser. The modal detects the brave wallet and it shows it as a first option, but same error connection declined.
I'm using the latest versions 1.4.1 of appkit, appkit-wagmi-adapters
hi @KAlamurov, Browser waller in a known issue. where are going to solve it ASAP. https://linear.app/reown/issue/APKT-1432/[bug]-browser-wallet-is-showing-in-all-mobile-web-an-its-falling
Thanks @rtomas 🙏
@rtomas @KAlamurov any news?
Nope, still the same with 1.5.0 > @rtomas @KAlamurov any news?
ecerpeincing same issue when trying to connect to metamask
Connection declined Connection can be declined if a previous request is still active
'use client';
import { wagmiAdapter, projectId } from '@/config'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { createAppKit } from '@reown/appkit/react'; import { flare } from '@reown/appkit/networks'; import React, { ReactNode } from 'react'; import { cookieToInitialState, WagmiProvider, Config } from 'wagmi'; import NetworkLogger from '@/components/NetworkLogger'; // New component to handle logging
// Set up queryClient const queryClient = new QueryClient();
if (!projectId) { throw new Error('Project ID is not defined'); }
// Set up metadata const metadata = { name: 'Billi Bears Rarity DApp', description: 'A DApp to find the rarest or non-rarest Billi Da Bears NFTs.', url: 'https://appkitexampleapp.com', // origin must match your domain & subdomain icons: ['https://billidabear.vercel.app/assets/images/BearLogo.png'], };
// Create the modal createAppKit({ adapters: [wagmiAdapter], projectId,
networks: [flare], defaultNetwork: flare, enableWalletConnect: true, metadata: metadata, debug: true, chainImages: { 14: 'https://docs.flare.network/assets/images/dev/reference/logo-FLR.png', }, features: { analytics: true, // Optional - defaults to your Cloud configuration }, tokens: { "eip155:14": { address: '0x01E396a10080eC2838D615162B17940b45D5E227', image: 'https://billidabear.vercel.app/assets/images/BearLogo.png' //optional }, } });
function ContextProvider({ children, cookies }: { children: ReactNode; cookies: string | null }) { const initialState = cookieToInitialState(wagmiAdapter.wagmiConfig as Config, cookies);
return ( <WagmiProvider config={wagmiAdapter.wagmiConfig as Config} initialState={initialState}> <QueryClientProvider client={queryClient}> <NetworkLogger /> {/* Logs network and account info */} {children} </QueryClientProvider> </WagmiProvider> ); }
export default ContextProvider;
import { cookieStorage, createStorage } from '@wagmi/core'; import { WagmiAdapter } from '@reown/appkit-adapter-wagmi'; import { flare } from '@reown/appkit/networks';
// Get projectId from environment variable export const projectId = process.env.NEXT_PUBLIC_PROJECT_ID;
if (!projectId) { throw new Error('Project ID is not defined'); }
export const networks = [ flare];
// Set up the Wagmi Adapter export const wagmiAdapter = new WagmiAdapter({ storage: createStorage({ storage: cookieStorage }), ssr: true, projectId, networks });
export const config = wagmiAdapter.wagmiConfig;
import type { Metadata } from 'next'; import { Inter } from 'next/font/google'; import './globals.css'; import CustomCursor from '@/components/Landing-Page-Components/CustomCursor'; import Header from '@/components/Landing-Page-Components/Header'; import Footer from '@/components/Landing-Page-Components/Footer'; import PageLoader from '@/components/Loader/PageLoader'; import ContextProvider from '@/context'; import AuthLayout from '@/components/AuthLayout'; import Script from 'next/script'; import { headers } from 'next/headers'; import { ChakraProvider } from '@chakra-ui/react'; import { TooltipProvider } from '@radix-ui/react-tooltip';
const inter = Inter({ subsets: ['latin'] });
export const metadata: Metadata = { title: 'AppKit Example App', description: 'Powered by Reown', };
export default async function RootLayout({ children, }: Readonly<{ children: React.ReactNode; }>) { // Safely fetch cookies using headers() const cookies = (await headers()).get('cookie') ?? null;
return (
<Script src="https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js" strategy="lazyOnload" /> <meta charSet="UTF-8" />
issue solved: for me i had to restart extension