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
Describe the bug
I use a ws connection from my Nodejs app, that uses web3 libraries. The connection via wss works properly with the public API of the IOTA evm testnet and I can interact with smart contracts and even listen to events. The problem is with a local wasp node and a private chain that I deployed. The connection is made with ws (and not wss) as the wasp node runs with HTTP (not HTTPS). With wscat I am able to get a response. The nodejs app initially connects with the web socket, and I can call view functions from a smart contract, but when I try to call a normal function (i.e. where I have to spend gas) or subscribe to events, the connection stops. Moreover, once I do that, with wscat I am not able anymore to connect to the web socket, and I get "error: Unexpected server response: 429". To get it working again I need to run "docker compose down" and then "docker compose up".
To Reproduce
Run a local HTTP(s) hornet node and wasp node.
Deploy a private chain
Deploy a simple smart contract to the chain
Connect to the ws via the Web3 functions
Interact with the contract, via Web3 functions
See error
Expected behavior
The connection should not stop, as it is working without errors in public testnets.
Screenshots
Screenshot of the error in my nodejs app (running on localhost:3000)
Network and versioning
Type of L1 network: IOTA testnet
Type of Wasp chain: Private chain
Interaction method: JSON/RPC Websocket
Interaction software: Web3 libraries, nodejs app
Version of Wasp 1.2.0-alpha.1 and 1.4.0-alpha.3
Additional context
The connection to the web socket from the nodejs app, is made with: web3 = new Web3(new Web3.providers.WebsocketProvider(ws://localhost/wasp/api/v1/chains/tst1pqsvlxmlvj9fkq6uuz0y48m6wucgdsqpt70ftmgzn95ase5wrjtqy7msdq4/evm/ws));
The text was updated successfully, but these errors were encountered:
beawareoftheg
changed the title
Local Web Socket connection (ws:/) not working properly with Nodejs app.
Web Socket connection (ws:/) not working properly with Nodejs app and Web3 libraries.
Jul 23, 2024
Update: I tried with a wss connection.
I ran a similar node but with a https connection. But the outcome it's still the same: when I try to call a normal function of the contract or subscribe to event, it gives me: "Unexpected server response: 429", that for what I understood, it's a Too Many Requests error.
Another update: the problem seems to be related to executing the nodejs app in the same node. I tried to run the nodejs app in another vm, connecting to the one running wasp. It seems that, by limiting the action's rates (e.g., only one subscription to the event at a time), the interactions works. But still, running it in the same node is not working, even by limiting the actions.
Moreover, connecting to wss of public testnets, there are no errors and it is possible to perform all the actions together without problems
I cannot try with newer versions of web3 for the #3392 issue.
beawareoftheg
changed the title
Web Socket connection (ws:/) not working properly with Nodejs app and Web3 libraries.
Web Socket connection (ws:/ and wss:/) not working properly with Nodejs app and Web3 libraries.
Jul 25, 2024
Describe the bug
I use a ws connection from my Nodejs app, that uses web3 libraries. The connection via wss works properly with the public API of the IOTA evm testnet and I can interact with smart contracts and even listen to events. The problem is with a local wasp node and a private chain that I deployed. The connection is made with ws (and not wss) as the wasp node runs with HTTP (not HTTPS). With wscat I am able to get a response. The nodejs app initially connects with the web socket, and I can call view functions from a smart contract, but when I try to call a normal function (i.e. where I have to spend gas) or subscribe to events, the connection stops. Moreover, once I do that, with wscat I am not able anymore to connect to the web socket, and I get "error: Unexpected server response: 429". To get it working again I need to run "docker compose down" and then "docker compose up".
To Reproduce
Expected behavior
The connection should not stop, as it is working without errors in public testnets.
Screenshots
![Schermata del 2024-07-22 12-50-47](https://private-user-images.githubusercontent.com/17273214/350938030-e585e5fb-fa76-48b8-8620-3dee8692f1c3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU0Mjg1MjEsIm5iZiI6MTcyNTQyODIyMSwicGF0aCI6Ii8xNzI3MzIxNC8zNTA5MzgwMzAtZTU4NWU1ZmItZmE3Ni00OGI4LTg2MjAtM2RlZTg2OTJmMWMzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTA0VDA1MzcwMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWRhOTEzMmUyMDNkYzBiODA5ODZjZDdhZWQwZDgwNzc0NThjNTAyNGIyN2VmMjBlOWUzOGNjOTNlNjBiOGI2ODMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.XdoKgnl8X0t4jVsd-GT0LNX1yB-Qp19Q03CqA0QDf4U)
Screenshot of the error in my nodejs app (running on localhost:3000)
Network and versioning
Additional context
The connection to the web socket from the nodejs app, is made with: web3 = new Web3(new Web3.providers.WebsocketProvider(ws://localhost/wasp/api/v1/chains/tst1pqsvlxmlvj9fkq6uuz0y48m6wucgdsqpt70ftmgzn95ase5wrjtqy7msdq4/evm/ws));
The text was updated successfully, but these errors were encountered: