Iâve had this error message a few times. After reading all the posts and trying everything, and it usually ended up being the result of trying to console.log something that was not yet ready or some other type error.
But now I have it again
Access to fetch at 'https://speedy-nodes-nyc.moralis.io/xxxxxxxxxxxxxxxxxx/eth/goerli' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
This time it is happening when Iâm trying to send a transaction from a signer attached to an rpcProvider using the moralis speedy nodes, using ethers.js. Iâm trying to send ether to accounts NOT using Metamask but with new accounts created in the app. There are some demo apps that do this using Web3.js but Ethers.js treats the signers differently and maybe Iâm doing something wrong.
This is right around where the error happens, in a catch block of this:
tx = {
gasLimit: gasLimit,
gasPrice: gasPrice,
to: tempWallet.address,
value: value,
};
}
signer
.sendUncheckedTransaction(tx)
.then((txObj) => {
txObj.wait();
console.log("txHash", txObj.hash);
This is the response.
Error: missing response (requestBody="{\"method\":\"eth_sendTransaction\",\"params\":[{\"gas\":\"0x5208\",\"gasPrice\":\"0x54f4dc53\",\"value\":\"0x372458e8d0768\",\"from\":\"0xxxxxxxxxxxxxxxxxxxxxxxxxx\",\"to\":\"0x78ffb95017388d09fdfa7e6856bbbbba8de5e55e\"}],\"id\":47,\"jsonrpc\":\"2.0\"}", requestMethod="POST", serverError={}, url="https://speedy-nodes-nyc.moralis.io/xxxxxxxxxxxxxxxxx/eth/goerli", code=SERVER_ERROR, version=web/5.6.0)
Any idea? Iâm really confused by the whole CORS error that keeps popping up in surprising places and is really hard to track down.