Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第12课。连接不到infura。报错1006 #212

Open
guhexuan opened this issue May 1, 2023 · 0 comments
Open

第12课。连接不到infura。报错1006 #212

guhexuan opened this issue May 1, 2023 · 0 comments

Comments

@guhexuan
Copy link

guhexuan commented May 1, 2023

[请问这该如何解决

C:\Windows\System32\profitable-flashloans>node run-arbitrage.js
Error: connection not open on send()
at Object.ConnectionError (C:\Windows\System32\profitable-flashloans\node_modules\web3-core-helpers\lib\errors.js:66:23)
at Object.ConnectionNotOpenError (C:\Windows\System32\profitable-flashloans\node_modules\web3-core-helpers\lib\errors.js:49:21)
at C:\Windows\System32\profitable-flashloans\node_modules\web3-providers-ws\lib\index.js:156:37
at Map.forEach ()
at WebsocketProvider._onConnectFailed (C:\Windows\System32\profitable-flashloans\node_modules\web3-providers-ws\lib\index.js:155:27)
at WebSocketClient.emit (node:events:513:28)
at WebSocketClient.failHandshake (C:\Windows\System32\profitable-flashloans\node_modules\websocket\lib\WebSocketClient.js:339:10)
at ClientRequest. (C:\Windows\System32\profitable-flashloans\node_modules\websocket\lib\WebSocketClient.js:278:18)
at ClientRequest.emit (node:events:513:28)
at HTTPParser.parserOnIncomingClient (node:_http_client:701:27)
at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17)
at TLSSocket.socketOnData (node:_http_client:542:22)
at TLSSocket.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Readable.push (node:internal/streams/readable:234:10) {
code: 1006,
reason: 'connection failed',
description: 'Error: Server responded with a non-101 status: 503 Service Temporarily Unavailable'
}

@jklepatch
这是我跟着教学视频写的
require("dotenv").config();
const Web3 = require('web3');
const web3 = new Web3(
new Web3.providers.WebsocketProvider(process.env.INFURA_URL)
);

web3.eth.subscribe('newBlockHeaders')
.on('data', async block => {
console.log(New block received. Block # ${block.number});
})
.on('error', error => {
console.log(error);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant