You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error: invalid response - 0
at request.onreadystatechange (d:\设计网页\node_modules\ethers\utils\web.js:84:29)
at exports.XMLHttpRequest.dispatchEvent (d:\设计网页\node_modules\xmlhttprequest\lib\XMLHttpRequest.js:591:25)
at setState (d:\设计网页\node_modules\xmlhttprequest\lib\XMLHttpRequest.js:610:14)
at exports.XMLHttpRequest.handleError (d:\设计网页\node_modules\xmlhttprequest\lib\XMLHttpRequest.js:532:5)
at ClientRequest.errorHandler (d:\设计网页\node_modules\xmlhttprequest\lib\XMLHttpRequest.js:459:14)
at ClientRequest.emit (node:events:517:28)
at TLSSocket.socketErrorListener (node:_http_client:501:9)
at TLSSocket.emit (node:events:517:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3) {
statusCode: 0,
responseText: 'Error: read ECONNRESET\n' +
' at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20)'
}
Node.js v18.18.1
Code Snippet
import {ethers} from "ethers"// ts ES6
const Mainnet_RPC = 'https://eth-mainnet.g.alchemy.com/v2/Sp3-m00XFKs2Bs7LC8MyGn4Cx94CpIwl';
const Sophie_RPC = 'https://eth-sepolia.g.alchemy.com/v2/3uvxjzVO19PqwZSiiprJ7nCa2vm0zDlc';
const provider = new ethers.providers.JsonRpcProvider(Mainnet_RPC);
const Testprovider = new ethers.providers.JsonRpcProvider(Sophie_RPC);
const main = async () => {
const balance = await provider.getBalance(`ethers.eth`);
console.log(`ETH Balance of vitalik: ${ethers.utils.formatEther(balance)} ETH`);
const blockNumber = await provider.getBlockNumber();
console.log(`now the blockchain high is :`, blockNumber)
// ethers.utils.parseEther("1.0") { BigNumber: "1000000000000000000" }
}
main()
Contract ABI
No response
Errors
Error: invalid response - 0
at request.onreadystatechange (d:\设计网页\node_modules\ethers\utils\web.js:84:29)
at exports.XMLHttpRequest.dispatchEvent (d:\设计网页\node_modules\xmlhttprequest\lib\XMLHttpRequest.js:591:25)
at setState (d:\设计网页\node_modules\xmlhttprequest\lib\XMLHttpRequest.js:610:14)
at exports.XMLHttpRequest.handleError (d:\设计网页\node_modules\xmlhttprequest\lib\XMLHttpRequest.js:532:5)
at ClientRequest.errorHandler (d:\设计网页\node_modules\xmlhttprequest\lib\XMLHttpRequest.js:459:14)
at ClientRequest.emit (node:events:517:28)
at TLSSocket.socketErrorListener (node:_http_client:501:9)
at TLSSocket.emit (node:events:517:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3) {
statusCode: 0,
responseText: 'Error: read ECONNRESET\n' +
' at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20)'
}
Node.js v18.18.1
Environment
node.js (v12 or newer)
Environment (Other)
No response
The text was updated successfully, but these errors were encountered:
This error generally indicates a server SSL error. It could be a proxy was messing up the SSL/TLS data, the certificate could have been expired, the server could have been throttling you, etc.
There isn't much Ethers can do to resolve this directly, but it is strange that the error response looks like that of a WebSocket, but you are using the HTTP-based Providers. Can you provide more context as to what you were doing, the network situation, etc?
Ethers Version
5
Search Terms
utf8
Describe the Problem
Error: invalid response - 0
at request.onreadystatechange (d:\设计网页\node_modules\ethers\utils\web.js:84:29)
at exports.XMLHttpRequest.dispatchEvent (d:\设计网页\node_modules\xmlhttprequest\lib\XMLHttpRequest.js:591:25)
at setState (d:\设计网页\node_modules\xmlhttprequest\lib\XMLHttpRequest.js:610:14)
at exports.XMLHttpRequest.handleError (d:\设计网页\node_modules\xmlhttprequest\lib\XMLHttpRequest.js:532:5)
at ClientRequest.errorHandler (d:\设计网页\node_modules\xmlhttprequest\lib\XMLHttpRequest.js:459:14)
at ClientRequest.emit (node:events:517:28)
at TLSSocket.socketErrorListener (node:_http_client:501:9)
at TLSSocket.emit (node:events:517:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3) {
statusCode: 0,
responseText: 'Error: read ECONNRESET\n' +
' at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20)'
}
Node.js v18.18.1
Code Snippet
Contract ABI
No response
Errors
Environment
node.js (v12 or newer)
Environment (Other)
No response
The text was updated successfully, but these errors were encountered: