-
Notifications
You must be signed in to change notification settings - Fork 109
HydraProvider.isConnected() silently ignores Greetings message — _connectionState never set to "CONNECTING" #817
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Summary
HydraProvider.isConnected() never resolves successfully because the onMessage callback has a guard that checks this._connectionState !== "CONNECTING", but _connectionState is never set to "CONNECTING". It starts as "IDLE" and the guard causes the Greetings message to be silently ignored, always resulting in a timeout.
Steps to reproduce the bug
Connect to any running Hydra node v1.2.0:
import { HydraProvider } from '@meshsdk/hydra';
const hp = new HydraProvider({
url: 'http://localhost:4001',
wsUrl: 'ws://localhost:4001',
});
// This always times out, even though the node sends a valid Greetings
const connected = await hp.isConnected(10000);The WebSocket connects (logs "Hydra websocket connected"), and the Hydra node sends a valid Greetings message:
{
"tag": "Greetings",
"headStatus": "Idle",
"hydraNodeVersion": "...",
"me": {"vkey": "..."},
"env": {...},
"networkInfo": {...}
}Actual Result
isConnected() always throws Error: Connection timed out: no Greetings from Hydra node.
Expected Result
Expect to see a message about the head being connected via the eventHandler.
SDK version
1.9.0-beta.99
Environment type
- Node.js
- Browser
- Browser Extension
- Other
Environment details
@meshsdk/hydra:1.9.0-beta.99- Hydra node:
ghcr.io/cardano-scaling/hydra-node:1.2.0 - Node.js:
v22.22.2 - Network: Cardano preprod testnet
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working