Error attempting to connect to function of contract deployed to Robson server.
Error: Invalid JSON RPC response: {"size":0,"timeout":0}
This is my code.
const call = () => {
const CONTRACT_ADDRESS = "0xEF7D71764b5fe95f8584D70bF3B1Ead15CAF89eD";
const address = "";
const fundRasing = new web3.eth.Contract(abi, CONTRACT_ADDRESS);
fundRasing.methods.beneficiary().call({from: address}).then(console.log);
};
call();
please help me
It seems an issue with connecting to your server or an issue with geth (or the Ethereum client) configuration. But web3.js did not report the issue clearly.
And to confirm that the issue is with the geth configuration (or the Ethereum client you are using), and how it is being accessed, try running geth with --rpcaddr 0.0.0.0 and --rpccorsdomain "*". And you are supposed to not face this error again. If this did not work try running geth on your local machine to be able to investigate.
However, it is extremely dangerous to have this mentioned configuration (--rpcaddr 0.0.0.0 and --rpccorsdomain "*"). But I recommend you do this in a test machine to confirm the issue's root cause. But for a production environment, you would need different setups and configurations according to your exact case.
You nay follow up with the issue here: https://github.com/web3/web3.js/issues/5661#issuecomment-1332506572
Related
I have a Python file which talks to a JavaScript file via socket.io and socket.io-client. The debugger output on the server side is shown below.
Debugger output: https://i.stack.imgur.com/pL1p7.png
I've tried implementing some fixes recommended in similar posts, for example I changed
const socket = io(SOCKETIO_URL)
to
var options = {};
options.transports = ['websocket'];
const socket = io(SOCKETIO_URL, options , {transports: ['websocket', 'polling', 'flashsocket']});
but that just yields this error: https://i.stack.imgur.com/QcUEX.png.
Any help would be appreciated.
I was running into a similar issue and turned out it was caused by version mismatch between socket-io client and socket-io server packages. So make sure you're using similar versions socket io on your server and client.
I have a basic nodeJS application that connects to a server via a secured websocket (ws library) connection. When connecting the server keeps throwing a UNABLE_TO_VERIFY_LEAF_SIGNATURE error. I have no control over the server, it's external. The endpoint starts with wss:// (not sure if it makes a difference)
I have tried so many things, but none of them seem to work:
rejectUnauthorized: false works, but connection breaks after x time with 1006
export NODE_EXTRA_CA_CERTS=[your CA certificate file path] doesn't work
npm config set cafile [your CA certificate file path] doesn't work
npm modules syswide-cas or node-ssl-root-cas don't work
adding ca: [fs.readFileSync("ca.ca-bundle", {encoding: 'utf-8'})] in socket options doesn't work
However, when I navigate in a browser to the endpoint, the connection is valid and secured. I tried extracting the certificates from the browser and included into nodeJS, no results, same error. The same goes for when I use the website https://whatsmychaincert.com/ to get the certificates ...
Basic code:
this.websocket = new WebSocket(this.apiUrl, this.applicationId, {
rejectUnauthorized: true,
});
...
this.websocket.on('open', () => {
console.log('Connection successfully opened');
});
this.websocket.on('error', error => {
console.log(error);
});
No matter what I do, it seems that regardless the included certificates NodeJS keeps throwing me the UNABLE_TO_VERIFY_LEAF_SIGNATURE error.
Somebody any idea what is happening?
After days and days of trying to solve this I finally managed to solve this issue!
I was using the wrong certificate chain the whole time. The endpoint which I'm connecting to has a wss:// prefix. But I was getting the certificates from the url with the https:// prefix. Apparently this has a different certificate chain.
I have used socket.io, Node.JS, and express to create a real-time chat application that I could view by creating a local server. However, instead of using a local server, I would like to point my client to an existent heroku service. How do I go about doing this?
When I do the following,
var spot = io("https://spotim-demo-chat-server.herokuapp.com");
all functions relating to connecting, disconnecting, username registration, and messaging seem to fail. They do not function in the chat nor do their console.log messages appear in terminal.
I have also considered creating a HTTP server and having it listen to the port and IP address of the heroku service with .listen(). However for my assignment, I was not provided with either of these values, simply the heroku url.
I'm not sure where you're having trouble without more code from you. I've setup a basic socket.io client as follows and can connect without issue. You can run it with the following to see just the client's messages DEBUG=spot-client node client.js or if you wish to see all the debug info from the socket client itself as well DEBUG=* node client.js. The latter might help you diagnose the issue further. Also be sure to install the socket.io-client and debug packages. Hope this helps!
const io = require('socket.io-client');
const debug = require('debug')('spot-client');
var spot = io("https://spotim-demo-chat-server.herokuapp.com");
spot.on('connect', function(){
debug("connected");
});
spot.on('event', function(data){
debug("event",data);
});
spot.on('disconnect', function(){
debug("disconnect");
});
I'm trying to use the mysql module to connect to my database. But everytime, I get the following error: read eCONNRESET There is problem. (Note, that last part is from my console log. See below.)
I don't think this is a problem with database security settings. I've been trying to connect to my new database (hosted on AWS) for the last several days with no luck. Then, just now I attempted to connect to an Azure database that has been running smoothly for a couple years. Same problem: read eCONNRESET.
By the way, if I randomly change the host string to something invalid, my code returns an error saying the host wasn't found. So that tells me it's working to some extent.
I'm very new to the coding world and need all the help I can get.
Here's my code:
console.log('starting Launch');
var mysql = require('mysql');
var connection = mysql.createConnection({
host : '....windows.net',
user : 'test',
password : 'test',
port : '1433'
})
console.log('step2')
connection.connect(function (err) {
if (!err)
console.log("conncetd");
else
console.log(err + "There is problem");
});
Copy full error message.
Check connectivity to your DB instance, use nmap (linux) or telnet (windows). If you can't reach host - check your local machine and server firewall, restrictions. If you can, go to 2.
Try to use different MySQL client, MySQL WorkBench, HeidiSQL, DBeaver.
If you can't - than something wrong with MySQL configuration. If you can, go to 3.
Copy info about: OS, node version, mysql module version.
you could try
mysql.createPool({});
instead of
mysql.createConnection({})
I am new to WebRTC and WebSockets and was following this tutorial to create a WebRTC demo project, but I am unable to create a WebSocket connection. I have followed the same steps as mentioned in the project.
His project is running on port 8080 and he mentioned ws://localhost:9090. My project is running on port 8081, but I copied his URL ws://localhost:9090 because I didn't know the significance of 9090 and I received this error and my server is node.js. i changed local host to 8081 as well but then i am getting hand shake error.
WebSocket connection to 'ws://localhost:9090/' failed: Error in
connection establishment: net::ERR_CONNECTION_REFUSED.
Chrome doesn't allow unsecure websocket (ws) connections to localhost (only wss, so you should setup a TLS certificate for your local web/websocket server).
However the same should work fine with Firefox.
You need to use ws://yourIp:9090/, where yourIP is like 192.168.?.?.
Usually WebRTC requires a secure connection (that is https).
The error you have got is due to TLS/SSL certificates occupied, may be they are not properly configured in your project.
Provide a valid TLS/SSL certificate and also configure it correctly in project, then it will work without the above error.
try to change the port to 8080
const ws = new WebSocket('ws://localhost:8080/chat')
I guess this is a generic websocket issue.
Change the url to a dynamic name using the built-in location.host variable and change the protocol to secure websocket wss if you have set-up the TLS:
const ws = new WebSocket("wss://" + location.host + "/")
Port 9090 is used by reactotron. Probably you are using it in your project and your app cannot connect with reactotron because it is closed. Just open reactotron and the error will disappear.
also you could easily change the mappings of IP addresses to host names,
on windows go to C:\Windows\System32\drivers\etc\hosts and uncomment this line
127.0.0.1 localhost
save and restart.
WebSocket connection to 'ws://localhost:8080/' failed
Must ensure server file is running
I git this above problem
maybe you forgot to start websocket server, check it again, with configuration in my project, run:
php artisan websocket:init