Hi,
When I try to connect/subscribe to SpotUserDataStream, I get an error message stating Invalid API key, IP, or permissions for action. (code: 2015).
const wsClient = new WebsocketClient({
beautify: true,
wsUrl: "wss://testnet.binance.vision",
api_key: API_KEY,
api_secret: API_SECRET,
});
await wsClient.subscribeSpotUserDataStream();
Workaround
I tracked the error,
In the websocket-client.js file the subscribeSpotUserDataStream() method calls the getSpotRestClient() method, which tries to connect to real network instead of testnet.
When I added the baseUrl option for the spot client to use testnet, the problem was solved. However:
baseUrl is not a defined option in the WSClientConfigurableOptions
- This is undocumented.
const wsClient = new WebsocketClient({
beautify: true,
baseUrl: "https://testnet.binance.vision",
wsUrl: "wss://testnet.binance.vision",
api_key: API_KEY,
api_secret: API_SECRET,
});
await wsClient.subscribeSpotUserDataStream();
Hi,
When I try to connect/subscribe to
SpotUserDataStream, I get an error message statingInvalid API key, IP, or permissions for action.(code: 2015).Workaround
I tracked the error,
In the
websocket-client.jsfile thesubscribeSpotUserDataStream()method calls thegetSpotRestClient()method, which tries to connect to real network instead of testnet.When I added the
baseUrloption for the spot client to use testnet, the problem was solved. However:baseUrlis not a defined option in theWSClientConfigurableOptions