web3modal icon indicating copy to clipboard operation
web3modal copied to clipboard

[bug] SecurityError: Blocked a frame with origin "http://localhost:3000" from accessing a cross-origin frame.

Open vietddude opened this issue 1 year ago • 2 comments

Link to minimal reproducible example

https://github.com/WalletConnect/web-examples

Summary

Got this error while click to button Open Connect Modal Screenshot 2024-01-26 at 11 40 37 AM clicking

List of related npm package versions

"@emotion/react": "^11.11.3", "@emotion/styled": "^11.11.0", "@fontsource/roboto": "^5.0.8", "@mui/material": "^5.15.6", "@tanstack/react-query": "^5.17.19", "@wagmi/core": "^2.5.0", "@web3modal/wagmi": "4.0.0-3a0b2d54", "axios": "^1.6.5", "next": "^14.1.0", "react": "^18", "react-dom": "^18", "react-hook-form": "^7.49.3", "viem": "^2.5.0", "wagmi": "^2.5.0"

vietddude avatar Jan 26 '24 04:01 vietddude

Hi can you try updating to 4.0.0-alpha.3 and clearing cache?

Updated to 4.0.0-alpha.3 and cleared cache, but still facing the issue.

vietddude avatar Jan 26 '24 06:01 vietddude

I believe I am seeing the same issue. I am trying to do a write operation on a smart contract and it looks like the browser is trying to open a modal. Not sure. Oddly, I did see a scenario where I got a popup on my mobile Metamask to confirm the transaction. That happened once, I am not seeing any response on my mobile Metamask. Looks like my desktop browser is trying to show a modal with a QR code but the transaction is just timing out. I have:

"@web3modal/wagmi": "4.1.1",
"wagmi": "^2.5.11",

I have the following error on my browser's console:

[Error] Blocked a frame with origin "https://XXX-XXX-XX-XX-XXX.ngrok-free.app" from accessing a frame with origin "https://verify.walletconnect.org". Protocols, domains, and ports must match.

davidkarim avatar Mar 24 '24 05:03 davidkarim

same problem using ethers

{
    "@web3modal/ethers": "^4.1.8",
    "ethers": "^6.11.1"
}

felipelincoln avatar Apr 16 '24 16:04 felipelincoln

Any updates ?? im facing the same issue here

manish252488 avatar Apr 17 '24 17:04 manish252488

This is the workaround I am using for now:

const { open } = useWeb3Modal();

function handleOpen(){
  try{
    open();
  } catch(_e){
    open();
  }
}

Because for me, calling open() twice it works. 🤷

felipelincoln avatar Apr 18 '24 06:04 felipelincoln

This is Verify API and doesn't affect the functionality of the SDK, it is correct if the domain doesn't match with the verified one, but this error should go away on production. So for staging non-verified links this error is expected.

glitch-txs avatar Apr 18 '24 21:04 glitch-txs

This is Verify API and doesn't affect the functionality of the SDK, it is correct if the domain doesn't match with the verified one, but this error should go away on production. So for staging non-verified links this error is expected.

@glitch-txs this is happening to me on production. Can you provide more details on how to fix it? I have the metadata.domain matching my production domain

felipelincoln avatar Apr 19 '24 15:04 felipelincoln

should be metadata.url

glitch-txs avatar Apr 19 '24 16:04 glitch-txs

should be metadata.url

sorry, yeah, I meant I have the metadata.url matching my prod url. this is what I have:

const ethersConfig = defaultConfig({
  metadata:  {
      name: 'Some Name',
      description: 'Some description',
      url: 'https://<mysubdomain>.<mydomain>.io/'
      icons: [''],
    },
  rpcUrl: '<rpc>',
  defaultChainId: 1,
})

felipelincoln avatar Apr 19 '24 18:04 felipelincoln

What's your project ID?

glitch-txs avatar Apr 19 '24 18:04 glitch-txs

1914112795a676dc1449b23b8bd1dc9e

felipelincoln avatar Apr 19 '24 19:04 felipelincoln

@felipelincoln you need to verify your domain: https://docs.walletconnect.com/cloud/verify

glitch-txs avatar Apr 20 '24 07:04 glitch-txs

This is the workaround I am using for now:

const { open } = useWeb3Modal();

function handleOpen(){
  try{
    open();
  } catch(_e){
    open();
  }
}

Because for me, calling open() twice it works. 🤷

nice work arround, works for me

manish252488 avatar Apr 22 '24 03:04 manish252488

@glitch-txs got it, thanks. Is there a way to disable the verify api though?

felipelincoln avatar Apr 23 '24 11:04 felipelincoln

Is there a way to disable the verify api though?

No because it's a security layer for wallets, but we will add the option to add more domains and whitelist localhost too

glitch-txs avatar Apr 23 '24 19:04 glitch-txs

Any update on this? This is blocking me from test it in local environment.

JohnCido avatar May 10 '24 04:05 JohnCido