jaggedsoft / node-binance-api

Node Binance API is an asynchronous node.js library for the Binance API designed to be easy to use.
MIT License
1.58k stars 768 forks source link

Binance test network statusCode: 401, statusMessage: 'Unauthorized' Error #814

Open NonameASecret opened 2 years ago

NonameASecret commented 2 years ago

i try the binance test network create marker order using below code. but it return 401 status code error

My binance coption code below

image

My marker buy order below

binance.marketBuy('GALAUSDT', 1000, {type: 'MARKET', newOrderRespType: 'FULL'}, function(error, response) {
    if ( error ) return console.error(error.statusMessage);
    console.log("Market Buy response", response);
    console.log("order id: " + response.orderId);
})

Marker buy order return below reponse / error

` <ref *2> IncomingMessage { _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: BufferList { head: null, tail: null, length: 0 }, length: 0, pipes: [], flowing: true, ended: true, endEmitted: true, reading: false, constructed: true, sync: true, needReadable: false, emittedReadable: false, readableListening: false, resumeScheduled: false, errorEmitted: false, emitClose: true, autoDestroy: true, destroyed: false, errored: null, closed: false, closeEmitted: false, defaultEncoding: 'utf8', awaitDrainWriters: null, multiAwaitDrain: false, readingMore: true, dataEmitted: true, decoder: null, encoding: null,

     },
     _events: [Object: null prototype] {
       end: [ [Function: responseOnEnd], [Function (anonymous)] ],
       close: [ [Function (anonymous)], [Function (anonymous)] ],
       data: [Function (anonymous)],
       error: [Function (anonymous)]
     },
     _eventsCount: 4,
     _maxListeners: undefined,
     socket: null,
     httpVersionMajor: 1,
     httpVersionMinor: 1,
     httpVersion: '1.1',
     complete: true,
     rawHeaders: [
       'Content-Type',
       'application/json;charset=UTF-8',
       'Content-Length',
       '70',
       'Connection',
       'keep-alive',
       'Date',
       'Fri, 15 Apr 2022 08:33:10 GMT',
       'Server',
       'nginx',
       'x-mbx-uuid',
       '8e3b8515-81f0-4920-906a-ead6d61d5b0e',
       'x-mbx-used-weight',
       '2',
       'x-mbx-used-weight-1m',
       '2',
       'Strict-Transport-Security',
       'max-age=31536000; includeSubdomains',
       'X-Frame-Options',
       'SAMEORIGIN',
       'X-Xss-Protection',
       '1; mode=block',
       'X-Content-Type-Options',
       'nosniff',
       'Content-Security-Policy',
       "default-src 'self'",
       'X-Content-Security-Policy',
       "default-src 'self'",
       'X-WebKit-CSP',
       "default-src 'self'",
       'Cache-Control',
       'no-cache, no-store, must-revalidate',
       'Pragma',
       'no-cache',
       'Expires',
       '0',
       'X-Cache',
       'Error from cloudfront',
       'Via',
       '1.1 2aabea8a9cbe7f03f67c33c45d1d592c.cloudfront.net (CloudFront)',
       'X-Amz-Cf-Pop',
       'SIN52-C2',
       'X-Amz-Cf-Id',
       'ehTbpbwH8BxxOBAigB9rnRbbnslmmTKitwN69KI1tzoMPqNkNjJamg=='
     ],
     rawTrailers: [],
     aborted: false,
     upgrade: false,
     url: '',
     method: null,
     statusCode: 401,
     statusMessage: 'Unauthorized',
     client: <ref *1> TLSSocket {
       _tlsOptions: {
         allowHalfOpen: undefined,
         pipe: false,
         secureContext: [SecureContext],
         isServer: false,
         requestCert: true,
         rejectUnauthorized: true,
         session: undefined,
         ALPNProtocols: undefined,
         requestOCSP: undefined,
         enableTrace: undefined,
         pskCallback: undefined,
         highWaterMark: undefined,
         onread: undefined,
         signal: undefined
       },
       _secureEstablished: true,
       _securePending: false,
       _newSessionPending: false,
       _controlReleased: true,
       secureConnecting: false,
       _SNICallback: null,
       servername: 'testnet.binance.vision',
       alpnProtocol: false,
       authorized: true,
       authorizationError: null,
       encrypted: true,
       _events: [Object: null prototype] {
         close: [Array],
         end: [Function: onReadableStreamEnd],
         newListener: [Function: keylogNewListener],
         secure: [Function: onConnectSecure],
         session: [Function (anonymous)],
         free: [Function: onFree],
         timeout: [Function: onTimeout],
         agentRemove: [Function: onRemove]
       },
       _eventsCount: 8,
       connecting: false,
       _hadError: false,
       _parent: null,
       _host: 'testnet.binance.vision',
       _readableState: ReadableState {
         objectMode: false,
         highWaterMark: 16384,
         buffer: BufferList { head: null, tail: null, length: 0 },
         length: 0,
         pipes: [],
         flowing: true,
         ended: false,
         endEmitted: false,
         reading: true,
         constructed: true,
         sync: false,
         needReadable: true,
         emittedReadable: false,
         readableListening: false,
         resumeScheduled: false,
         errorEmitted: false,
         emitClose: false,
         autoDestroy: true,
         destroyed: false,
         errored: null,
         closed: false,
         closeEmitted: false,
         defaultEncoding: 'utf8',
         awaitDrainWriters: null,
         multiAwaitDrain: false,
         readingMore: false,
         dataEmitted: true,
         decoder: null,
         encoding: null,
         [Symbol(kPaused)]: false
       },
       _maxListeners: undefined,
       _writableState: WritableState {
         objectMode: false,
         highWaterMark: 16384,
         finalCalled: false,
         needDrain: false,
         ending: false,
         ended: false,
         finished: false,
         destroyed: false,
         decodeStrings: false,
         defaultEncoding: 'utf8',
         length: 0,
         writing: false,
         corked: 0,
         sync: false,
         bufferProcessing: false,
         onwrite: [Function: bound onwrite],
         writecb: null,
         writelen: 0,
         afterWriteTickInfo: null,
         buffered: [],
         bufferedIndex: 0,
         allBuffers: true,
         allNoop: true,
         pendingcb: 0,
         constructed: true,
         prefinished: false,
         errorEmitted: false,
         emitClose: false,
         autoDestroy: true,
         errored: null,
         closed: false,
         closeEmitted: false,
         [Symbol(kOnFinished)]: []
       },
       allowHalfOpen: false,
       _sockname: null,
       _pendingData: null,
       _pendingEncoding: '',
       server: undefined,
       _server: null,
       ssl: TLSWrap {
         _parent: [TCP],
         _parentWrap: undefined,
         _secureContext: [SecureContext],
         reading: true,
         onkeylog: [Function: onkeylog],
         onhandshakestart: {},
         onhandshakedone: [Function (anonymous)],
         onocspresponse: [Function: onocspresponse],
         onnewsession: [Function: onnewsessionclient],
         onerror: [Function: onerror],
         [Symbol(owner_symbol)]: [Circular *1]
       },
       _requestCert: true,
       _rejectUnauthorized: true,
       parser: null,
       _httpMessage: ClientRequest {
         _events: [Object: null prototype],
         _eventsCount: 6,
         _maxListeners: undefined,
         outputData: [],
         outputSize: 0,
         writable: true,
         destroyed: true,
         _last: false,
         chunkedEncoding: false,
         shouldKeepAlive: true,
         maxRequestsOnConnectionReached: false,
         _defaultKeepAlive: true,
         useChunkedEncodingByDefault: true,
         sendDate: false,
         _removedConnection: false,
         _removedContLen: false,
         _removedTE: false,
         _contentLength: null,
         _hasBody: true,
         _trailer: '',
         finished: true,
         _headerSent: true,
         _closed: false,
         socket: [Circular *1],
         _header: 'POST /api/v3/order HTTP/1.1\r\n' +
           'User-Agent: Mozilla/4.0 (compatible; Node Binance API)\r\n' +
           'Content-type: application/x-www-form-urlencoded\r\n' +
           'X-MBX-APIKEY: i5hy7kB9Xi8Uu0KF1xya6uzhagWKsPEQt9D0X6R9xwBn7PS1OtrrY5xM6gjCw22H\r\n' +
           'host: testnet.binance.vision\r\n' +
           'content-length: 187\r\n' +
           'Connection: keep-alive\r\n' +
           '\r\n',
         _keepAliveTimeout: 0,
         _onPendingData: [Function: nop],
         agent: [Agent],
         socketPath: undefined,
         method: 'POST',
         maxHeaderSize: undefined,
         insecureHTTPParser: undefined,
         path: '/api/v3/order',
         _ended: true,
         res: [Circular *2],
         aborted: false,
         timeoutCb: null,
         upgradeOrConnect: false,
         parser: null,
         maxHeadersCount: null,
         reusedSocket: false,
         host: 'testnet.binance.vision',
         protocol: 'https:',
         [Symbol(kCapture)]: false,
         [Symbol(kNeedDrain)]: false,
         [Symbol(corked)]: 0,
         [Symbol(kOutHeaders)]: [Object: null prototype]
       },
       timeout: 0,
       [Symbol(res)]: TLSWrap {
         _parent: [TCP],
         _parentWrap: undefined,
         _secureContext: [SecureContext],
         reading: true,
         onkeylog: [Function: onkeylog],
         onhandshakestart: {},
         onhandshakedone: [Function (anonymous)],
         onocspresponse: [Function: onocspresponse],
         onnewsession: [Function: onnewsessionclient],
         onerror: [Function: onerror],
         [Symbol(owner_symbol)]: [Circular *1]
       },
       [Symbol(verified)]: true,
       [Symbol(pendingSession)]: null,
       [Symbol(async_id_symbol)]: 30,
       [Symbol(kHandle)]: TLSWrap {
         _parent: [TCP],
         _parentWrap: undefined,
         _secureContext: [SecureContext],
         reading: true,
         onkeylog: [Function: onkeylog],
         onhandshakestart: {},
         onhandshakedone: [Function (anonymous)],
         onocspresponse: [Function: onocspresponse],
         onnewsession: [Function: onnewsessionclient],
         onerror: [Function: onerror],
         [Symbol(owner_symbol)]: [Circular *1]
       },
       [Symbol(kSetNoDelay)]: false,
       [Symbol(lastWriteQueueSize)]: 0,
       [Symbol(timeout)]: Timeout {
         _idleTimeout: -1,
         _idlePrev: null,
         _idleNext: null,
         _idleStart: 1239,
         _onTimeout: null,
         _timerArgs: undefined,
         _repeat: null,
         _destroyed: true,
         [Symbol(refed)]: false,
         [Symbol(kHasPrimitive)]: false,
         [Symbol(asyncId)]: 70,
         [Symbol(triggerId)]: 66
       },
       [Symbol(kBuffer)]: null,
       [Symbol(kBufferCb)]: null,
       [Symbol(kBufferGen)]: null,
       [Symbol(kCapture)]: false,
       [Symbol(kBytesRead)]: 0,
       [Symbol(kBytesWritten)]: 0,
       [Symbol(connect-options)]: {
         rejectUnauthorized: true,
         ciphers: 'TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!SRP:!CAMELLIA',
         checkServerIdentity: [Function: checkServerIdentity],
         minDHSize: 1024,
         _events: [Object: null prototype],
         _eventsCount: 3,
         _maxListeners: undefined,
         method: 'POST',
         family: false,
         localAddress: false,
         forever: true,
         qsStringifyOptions: [Object],
         headers: [Object],
         callback: [Function (anonymous)],
         readable: true,
         writable: true,
         explicitMethod: true,
         _qs: [Querystring],
         _auth: [Auth],
         _oauth: [OAuth],
         _multipart: [Multipart],
         _redirect: [Redirect],
         _tunnel: [Tunnel],
         setHeader: [Function (anonymous)],
         hasHeader: [Function (anonymous)],
         getHeader: [Function (anonymous)],
         removeHeader: [Function (anonymous)],
         pool: [Object],
         dests: [],
         __isRequestRequest: true,
         _callback: [Function (anonymous)],
         uri: [Url],
         proxy: null,
         tunnel: true,
         setHost: true,
         originalCookieHeader: undefined,
         _disableCookies: true,
         _jar: undefined,
         port: 443,
         host: 'testnet.binance.vision',
         body: 'symbol=GALAUSDT&side=BUY&type=MARKET&quantity=1000&newOrderRespType=FULL&timestamp=1650011589261&recvWindow=5000&signature=d623633b43f628f94e480b1f4cc878f870569daba80c76138f184085a6f25c28',
         path: null,
         httpModule: [Object],
         agentClass: [Function: Agent],
         agentOptions: [Object],
         agent: [Agent],
         _started: true,
         href: 'https://testnet.binance.vision/api/v3/order',
         secureEndpoint: true,
         _defaultAgent: [Agent],
         keepAlive: true,
         servername: 'testnet.binance.vision',
         _agentKey: 'testnet.binance.vision:443:::::::::::::::::::::',
         encoding: null
       },
       [Symbol(RequestTimeout)]: undefined
     },
     _consuming: false,
     _dumped: false,
     req: <ref *3> ClientRequest {
       _events: [Object: null prototype] {
         response: [Function: bound ],
         error: [Array],
         drain: [Function (anonymous)],
         socket: [Function (anonymous)],
         timeout: [Function],
         prefinish: [Function: requestOnPrefinish]
       },
       _eventsCount: 6,
       _maxListeners: undefined,
       outputData: [],
       outputSize: 0,
       writable: true,
       destroyed: true,
       _last: false,
       chunkedEncoding: false,
       shouldKeepAlive: true,
       maxRequestsOnConnectionReached: false,
       _defaultKeepAlive: true,
       useChunkedEncodingByDefault: true,
       sendDate: false,
       _removedConnection: false,
       _removedContLen: false,
       _removedTE: false,
       _contentLength: null,
       _hasBody: true,
       _trailer: '',
       finished: true,
       _headerSent: true,
       _closed: false,
       socket: <ref *1> TLSSocket {
         _tlsOptions: [Object],
         _secureEstablished: true,
         _securePending: false,
         _newSessionPending: false,
         _controlReleased: true,
         secureConnecting: false,
         _SNICallback: null,
         servername: 'testnet.binance.vision',
         alpnProtocol: false,
         authorized: true,
         authorizationError: null,
         encrypted: true,
         _events: [Object: null prototype],
         _eventsCount: 8,
         connecting: false,
         _hadError: false,
         _parent: null,
         _host: 'testnet.binance.vision',
         _readableState: [ReadableState],
         _maxListeners: undefined,
         _writableState: [WritableState],
         allowHalfOpen: false,
         _sockname: null,
         _pendingData: null,
         _pendingEncoding: '',
         server: undefined,
         _server: null,
         ssl: [TLSWrap],
         _requestCert: true,
         _rejectUnauthorized: true,
         parser: null,
         _httpMessage: [Circular *3],
         timeout: 0,
         [Symbol(res)]: [TLSWrap],
         [Symbol(verified)]: true,
         [Symbol(pendingSession)]: null,
         [Symbol(async_id_symbol)]: 30,
         [Symbol(kHandle)]: [TLSWrap],
         [Symbol(kSetNoDelay)]: false,
         [Symbol(lastWriteQueueSize)]: 0,
         [Symbol(timeout)]: Timeout {
           _idleTimeout: -1,
           _idlePrev: null,
           _idleNext: null,
           _idleStart: 1239,
           _onTimeout: null,
           _timerArgs: undefined,
           _repeat: null,
           _destroyed: true,
           [Symbol(refed)]: false,
           [Symbol(kHasPrimitive)]: false,
           [Symbol(asyncId)]: 70,
           [Symbol(triggerId)]: 66
         },
         [Symbol(kBuffer)]: null,
         [Symbol(kBufferCb)]: null,
         [Symbol(kBufferGen)]: null,
         [Symbol(kCapture)]: false,
         [Symbol(kBytesRead)]: 0,
         [Symbol(kBytesWritten)]: 0,
         [Symbol(connect-options)]: [Object],
         [Symbol(RequestTimeout)]: undefined
       },
       _header: 'POST /api/v3/order HTTP/1.1\r\n' +
         'User-Agent: Mozilla/4.0 (compatible; Node Binance API)\r\n' +
         'Content-type: application/x-www-form-urlencoded\r\n' +
         'X-MBX-APIKEY: i5hy7kB9Xi8Uu0KF1xya6uzhagWKsPEQt9D0X6R9xwBn7PS1OtrrY5xM6gjCw22H\r\n' +
         'host: testnet.binance.vision\r\n' +
         'content-length: 187\r\n' +
         'Connection: keep-alive\r\n' +
         '\r\n',
       _keepAliveTimeout: 0,
       _onPendingData: [Function: nop],
       agent: Agent {
         _events: [Object: null prototype],
         _eventsCount: 2,
         _maxListeners: undefined,
         defaultPort: 443,
         protocol: 'https:',
         options: [Object: null prototype],
         requests: [Object: null prototype] {},
         sockets: [Object: null prototype],
         freeSockets: [Object: null prototype],
         keepAliveMsecs: 1000,
         keepAlive: true,
         maxSockets: Infinity,
         maxFreeSockets: 256,
         scheduling: 'lifo',
         maxTotalSockets: Infinity,
         totalSocketCount: 1,
         maxCachedSessions: 100,
         _sessionCache: [Object],
         [Symbol(kCapture)]: false
       },
       socketPath: undefined,
       method: 'POST',
       maxHeaderSize: undefined,
       insecureHTTPParser: undefined,
       path: '/api/v3/order',
       _ended: true,
       res: [Circular *2],
       aborted: false,
       timeoutCb: null,
       upgradeOrConnect: false,
       parser: null,
       maxHeadersCount: null,
       reusedSocket: false,
       host: 'testnet.binance.vision',
       protocol: 'https:',
       [Symbol(kCapture)]: false,
       [Symbol(kNeedDrain)]: false,
       [Symbol(corked)]: 0,
       [Symbol(kOutHeaders)]: [Object: null prototype] {
         'user-agent': [Array],
         'content-type': [Array],
         'x-mbx-apikey': [Array],
         host: [Array],
         'content-length': [Array]
       }
     },
     request: <ref *4> Request {
       _events: [Object: null prototype] {
         error: [Array],
         complete: [Function: bound ],
         pipe: [Function (anonymous)],
         data: [Function (anonymous)],
         end: [Function (anonymous)]
       },
       _eventsCount: 5,
       _maxListeners: undefined,
       method: 'POST',
       family: false,
       localAddress: false,
       timeout: 5000,
       forever: true,
       qsStringifyOptions: { arrayFormat: 'repeat' },
       headers: {
         'User-Agent': 'Mozilla/4.0 (compatible; Node Binance API)',
         'Content-type': 'application/x-www-form-urlencoded',
         'X-MBX-APIKEY': 'i5hy7kB9Xi8Uu0KF1xya6uzhagWKsPEQt9D0X6R9xwBn7PS1OtrrY5xM6gjCw22H',
         'content-length': 187
       },
       callback: [Function (anonymous)],
       readable: true,
       writable: true,
       explicitMethod: true,
       _qs: Querystring {
         request: [Circular *4],
         lib: [Object],
         useQuerystring: undefined,
         parseOptions: {},
         stringifyOptions: [Object]
       },
       _auth: Auth {
         request: [Circular *4],
         hasAuth: false,
         sentAuth: false,
         bearerToken: null,
         user: null,
         pass: null
       },
       _oauth: OAuth { request: [Circular *4], params: null },
       _multipart: Multipart {
         request: [Circular *4],
         boundary: 'fabea334-e0df-4547-b743-7bd37833a246',
         chunked: false,
         body: null
       },
       _redirect: Redirect {
         request: [Circular *4],
         followRedirect: true,
         followRedirects: true,
         followAllRedirects: false,
         followOriginalHttpMethod: false,
         allowRedirect: [Function (anonymous)],
         maxRedirects: 10,
         redirects: [],
         redirectsFollowed: 0,
         removeRefererHeader: false
       },
       _tunnel: Tunnel {
         request: [Circular *4],
         proxyHeaderWhiteList: [Array],
         proxyHeaderExclusiveList: []
       },
       setHeader: [Function (anonymous)],
       hasHeader: [Function (anonymous)],
       getHeader: [Function (anonymous)],
       removeHeader: [Function (anonymous)],
       pool: { 'https:': [Agent] },
       dests: [],
       __isRequestRequest: true,
       _callback: [Function (anonymous)],
       uri: Url {
         protocol: 'https:',
         slashes: true,
         auth: null,
         host: 'testnet.binance.vision',
         port: 443,
         hostname: 'testnet.binance.vision',
         hash: null,
         search: null,
         query: null,
         pathname: '/api/v3/order',
         path: '/api/v3/order',
         href: 'https://testnet.binance.vision/api/v3/order'
       },
       proxy: null,
       tunnel: true,
       setHost: true,
       originalCookieHeader: undefined,
       _disableCookies: true,
       _jar: undefined,
       port: 443,
       host: 'testnet.binance.vision',
       body: 'symbol=GALAUSDT&side=BUY&type=MARKET&quantity=1000&newOrderRespType=FULL&timestamp=1650011589261&recvWindow=5000&signature=d623633b43f628f94e480b1f4cc878f870569daba80c76138f184085a6f25c28',
       path: '/api/v3/order',
       httpModule: {
         Agent: [Function: Agent],
         globalAgent: [Agent],
         Server: [Function: Server],
         createServer: [Function: createServer],
         get: [Function (anonymous)],
         request: [Function (anonymous)]
       },
       agentClass: [Function: Agent],
       agentOptions: { keepAlive: true },
       agent: Agent {
         _events: [Object: null prototype],
         _eventsCount: 2,
         _maxListeners: undefined,
         defaultPort: 443,
         protocol: 'https:',
         options: [Object: null prototype],
         requests: [Object: null prototype] {},
         sockets: [Object: null prototype],
         freeSockets: [Object: null prototype],
         keepAliveMsecs: 1000,
         keepAlive: true,
         maxSockets: Infinity,
         maxFreeSockets: 256,
         scheduling: 'lifo',
         maxTotalSockets: Infinity,
         totalSocketCount: 1,
         maxCachedSessions: 100,
         _sessionCache: [Object],
         [Symbol(kCapture)]: false
       },
       _started: true,
       href: 'https://testnet.binance.vision/api/v3/order',
       req: <ref *3> ClientRequest {
         _events: [Object: null prototype],
         _eventsCount: 6,
         _maxListeners: undefined,
         outputData: [],
         outputSize: 0,
         writable: true,
         destroyed: true,
         _last: false,
         chunkedEncoding: false,
         shouldKeepAlive: true,
         maxRequestsOnConnectionReached: false,
         _defaultKeepAlive: true,
         useChunkedEncodingByDefault: true,
         sendDate: false,
         _removedConnection: false,
         _removedContLen: false,
         _removedTE: false,
         _contentLength: null,
         _hasBody: true,
         _trailer: '',
         finished: true,
         _headerSent: true,
         _closed: false,
         socket: [TLSSocket],
         _header: 'POST /api/v3/order HTTP/1.1\r\n' +
           'User-Agent: Mozilla/4.0 (compatible; Node Binance API)\r\n' +
           'Content-type: application/x-www-form-urlencoded\r\n' +
           'X-MBX-APIKEY: i5hy7kB9Xi8Uu0KF1xya6uzhagWKsPEQt9D0X6R9xwBn7PS1OtrrY5xM6gjCw22H\r\n' +
           'host: testnet.binance.vision\r\n' +
           'content-length: 187\r\n' +
           'Connection: keep-alive\r\n' +
           '\r\n',
         _keepAliveTimeout: 0,
         _onPendingData: [Function: nop],
         agent: [Agent],
         socketPath: undefined,
         method: 'POST',
         maxHeaderSize: undefined,
         insecureHTTPParser: undefined,
         path: '/api/v3/order',
         _ended: true,
         res: [Circular *2],
         aborted: false,
         timeoutCb: null,
         upgradeOrConnect: false,
         parser: null,
         maxHeadersCount: null,
         reusedSocket: false,
         host: 'testnet.binance.vision',
         protocol: 'https:',
         [Symbol(kCapture)]: false,
         [Symbol(kNeedDrain)]: false,
         [Symbol(corked)]: 0,
         [Symbol(kOutHeaders)]: [Object: null prototype]
       },
       ntick: true,
       timeoutTimer: null,
       response: [Circular *2],
       originalHost: 'testnet.binance.vision',
       originalHostHeaderName: 'host',
       responseContent: [Circular *2],
       _destdata: true,
       _ended: true,
       _callbackCalled: true,
       [Symbol(kCapture)]: false
     },
     toJSON: [Function: responseToJSON],
     caseless: Caseless {
       dict: {
         'content-type': 'application/json;charset=UTF-8',
         'content-length': '70',
         connection: 'keep-alive',
         date: 'Fri, 15 Apr 2022 08:33:10 GMT',
         server: 'nginx',
         'x-mbx-uuid': '8e3b8515-81f0-4920-906a-ead6d61d5b0e',
         'x-mbx-used-weight': '2',
         'x-mbx-used-weight-1m': '2',
         'strict-transport-security': 'max-age=31536000; includeSubdomains',
         'x-frame-options': 'SAMEORIGIN',
         'x-xss-protection': '1; mode=block',
         'x-content-type-options': 'nosniff',
         'content-security-policy': "default-src 'self'",
         'x-content-security-policy': "default-src 'self'",
         'x-webkit-csp': "default-src 'self'",
         'cache-control': 'no-cache, no-store, must-revalidate',
         pragma: 'no-cache',
         expires: '0',
         'x-cache': 'Error from cloudfront',
         via: '1.1 2aabea8a9cbe7f03f67c33c45d1d592c.cloudfront.net (CloudFront)',
         'x-amz-cf-pop': 'SIN52-C2',
         'x-amz-cf-id': 'ehTbpbwH8BxxOBAigB9rnRbbnslmmTKitwN69KI1tzoMPqNkNjJamg=='
       }
     },
     body: '{"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."}',
     [Symbol(kCapture)]: false,
     [Symbol(kHeaders)]: {
       'content-type': 'application/json;charset=UTF-8',
       'content-length': '70',
       connection: 'keep-alive',
       date: 'Fri, 15 Apr 2022 08:33:10 GMT',
       server: 'nginx',
       'x-mbx-uuid': '8e3b8515-81f0-4920-906a-ead6d61d5b0e',
       'x-mbx-used-weight': '2',
       'x-mbx-used-weight-1m': '2',
       'strict-transport-security': 'max-age=31536000; includeSubdomains',
       'x-frame-options': 'SAMEORIGIN',
       'x-xss-protection': '1; mode=block',
       'x-content-type-options': 'nosniff',
       'content-security-policy': "default-src 'self'",
       'x-content-security-policy': "default-src 'self'",
       'x-webkit-csp': "default-src 'self'",
       'cache-control': 'no-cache, no-store, must-revalidate',
       pragma: 'no-cache',
       expires: '0',
       'x-cache': 'Error from cloudfront',
       via: '1.1 2aabea8a9cbe7f03f67c33c45d1d592c.cloudfront.net (CloudFront)',
       'x-amz-cf-pop': 'SIN52-C2',
       'x-amz-cf-id': 'ehTbpbwH8BxxOBAigB9rnRbbnslmmTKitwN69KI1tzoMPqNkNjJamg=='
     },
     [Symbol(kHeadersCount)]: 44,
     [Symbol(kTrailers)]: null,
     [Symbol(kTrailersCount)]: 0,
     [Symbol(RequestTimeout)]: undefined
   }`

how to handle this error?

cdiazr commented 2 years ago

Into same response are you getting the reason.

body: ' {"code":-2015, msg":"Invalid API-key, IP, or permissions for action."}',