Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error reveals Insight data in stack trace #548

Open
christroutner opened this issue Jan 17, 2020 · 1 comment
Open

Error reveals Insight data in stack trace #548

christroutner opened this issue Jan 17, 2020 · 1 comment
Labels
Ready Issue is actionable
Projects

Comments

@christroutner
Copy link

When Insight falls over, rest reveals its IP address in the stack trace. The scope of this issue is to improve the error handling so that this information is not displayed. Here is an example from a curl statement to rest when testnet Insight was down:

curl -X GET "https://trest.bitcoin.com/v2/address/details/bchtest:qz35h5mfa8w2pqma2jq06lp7dnv5fxkp2svtllzmlf" -H "accept: application/json"

Results in this returned:

{"error":"{ Error: connect ECONNREFUSED 159.203.177.17:3001\n    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1107:14)\n  errno: 'ECONNREFUSED',\n  code: 'ECONNREFUSED',\n  syscall: 'connect',\n  address: '159.203.177.17',\n  port: 3001,\n  config:\n   { url:\n      'http://159.203.177.17:3001/api/addr/mvQPGnzRT6gMWASZBMg7NcT3vmvsSKSQtf?from=0&to=1000',\n     method: 'get',\n     headers:\n      { Accept: 'application/json, text/plain, */*',\n        'User-Agent': 'axios/0.19.0' },\n     transformRequest: [ [Function: transformRequest] ],\n     transformResponse: [ [Function: transformResponse] ],\n     timeout: 0,\n     adapter: [Function: httpAdapter],\n     xsrfCookieName: 'XSRF-TOKEN',\n     xsrfHeaderName: 'X-XSRF-TOKEN',\n     maxContentLength: -1,\n     validateStatus: [Function: validateStatus],\n     data: undefined },\n  request:\n   Writable {\n     _writableState:\n      WritableState {\n        objectMode: false,\n        highWaterMark: 16384,\n        finalCalled: false,\n        needDrain: false,\n        ending: false,\n        ended: false,\n        finished: false,\n        destroyed: false,\n        decodeStrings: true,\n        defaultEncoding: 'utf8',\n        length: 0,\n        writing: false,\n        corked: 0,\n        sync: true,\n        bufferProcessing: false,\n        onwrite: [Function: bound onwrite],\n        writecb: null,\n        writelen: 0,\n        bufferedRequest: null,\n        lastBufferedRequest: null,\n        pendingcb: 0,\n        prefinished: false,\n        errorEmitted: false,\n        emitClose: true,\n        autoDestroy: false,\n        bufferedRequestCount: 0,\n        corkedRequestsFree:\n         { next: null,\n           entry: null,\n           finish: [Function: bound onCorkedFinish] } },\n     writable: true,\n     _events:\n      [Object: null prototype] {\n        response: [Function: handleResponse],\n        error: [Function: handleRequestError] },\n     _eventsCount: 2,\n     _maxListeners: undefined,\n     _options:\n      { protocol: 'http:',\n        maxRedirects: 21,\n        maxBodyLength: 10485760,\n        path:\n         '/api/addr/mvQPGnzRT6gMWASZBMg7NcT3vmvsSKSQtf?from=0&to=1000',\n        method: 'GET',\n        headers:\n         { Accept: 'application/json, text/plain, */*',\n           'User-Agent': 'axios/0.19.0' },\n        agent: undefined,\n        auth: undefined,\n        hostname: '159.203.177.17',\n        port: '3001',\n        nativeProtocols:\n         { 'http:':\n            { _connectionListener: [Function: connectionListener],\n              METHODS:\n               [ 'ACL',\n                 'BIND',\n                 'CHECKOUT',\n                 'CONNECT',\n                 'COPY',\n                 'DELETE',\n                 'GET',\n                 'HEAD',\n                 'LINK',\n                 'LOCK',\n                 'M-SEARCH',\n                 'MERGE',\n                 'MKACTIVITY',\n                 'MKCALENDAR',\n                 'MKCOL',\n                 'MOVE',\n                 'NOTIFY',\n                 'OPTIONS',\n                 'PATCH',\n                 'POST',\n                 'PROPFIND',\n                 'PROPPATCH',\n                 'PURGE',\n                 'PUT',\n                 'REBIND',\n                 'REPORT',\n                 'SEARCH',\n                 'SOURCE',\n                 'SUBSCRIBE',\n                 'TRACE',\n                 'UNBIND',\n                 'UNLINK',\n                 'UNLOCK',\n                 'UNSUBSCRIBE' ],\n              STATUS_CODES:\n               { '100': 'Continue',\n                 '101': 'Switching Protocols',\n                 '102': 'Processing',\n                 '103': 'Early Hints',\n                 '200': 'OK',\n                 '201': 'Created',\n                 '202': 'Accepted',\n                 '203': 'Non-Authoritative Information',\n                 '204': 'No Content',\n                 '205': 'Reset Content',\n                 '206': 'Partial Content',\n                 '207': 'Multi-Status',\n                 '208': 'Already Reported',\n                 '226': 'IM Used',\n                 '300': 'Multiple Choices',\n                 '301': 'Moved Permanently',\n                 '302': 'Found',\n                 '303': 'See Other',\n                 '304': 'Not Modified',\n                 '305': 'Use Proxy',\n                 '307': 'Temporary Redirect',\n                 '308': 'Permanent Redirect',\n                 '400': 'Bad Request',\n                 '401': 'Unauthorized',\n                 '402': 'Payment Required',\n                 '403': 'Forbidden',\n                 '404': 'Not Found',\n                 '405': 'Method Not Allowed',\n                 '406': 'Not Acceptable',\n                 '407': 'Proxy Authentication Required',\n                 '408': 'Request Timeout',\n                 '409': 'Conflict',\n                 '410': 'Gone',\n                 '411': 'Length Required',\n                 '412': 'Precondition Failed',\n                 '413': 'Payload Too Large',\n                 '414': 'URI Too Long',\n                 '415': 'Unsupported Media Type',\n                 '416': 'Range Not Satisfiable',\n                 '417': 'Expectation Failed',\n                 '418': 'I\\'m a Teapot',\n                 '421': 'Misdirected Request',\n                 '422': 'Unprocessable Entity',\n                 '423': 'Locked',\n                 '424': 'Failed Dependency',\n                 '425': 'Unordered Collection',\n                 '426': 'Upgrade Required',\n                 '428': 'Precondition Required',\n                 '429': 'Too Many Requests',\n                 '431': 'Request Header Fields Too Large',\n                 '451': 'Unavailable For Legal Reasons',\n                 '500': 'Internal Server Error',\n                 '501': 'Not Implemented',\n                 '502': 'Bad Gateway',\n                 '503': 'Service Unavailable',\n                 '504': 'Gateway Timeout',\n                 '505': 'HTTP Version Not Supported',\n                 '506': 'Variant Also Negotiates',\n                 '507': 'Insufficient Storage',\n                 '508': 'Loop Detected',\n                 '509': 'Bandwidth Limit Exceeded',\n                 '510': 'Not Extended',\n                 '511': 'Network Authentication Required' },\n              Agent:\n               { [Function: Agent] super_: [Function], defaultMaxSockets: Infinity },\n              ClientRequest: { [Function: ClientRequest] super_: [Function] },\n              IncomingMessage: { [Function: IncomingMessage] super_: [Function] },\n              OutgoingMessage: { [Function: OutgoingMessage] super_: [Function] },\n              Server: { [Function: Server] super_: [Function] },\n              ServerResponse: { [Function: ServerResponse] super_: [Function] },\n              createServer: [Function: createServer],\n              get: [Function: get],\n              request: [Function: request],\n              maxHeaderSize: [Getter],\n              globalAgent: [Getter/Setter] },\n           'https:':\n            { Agent: { [Function: Agent] super_: [Function] },\n              globalAgent:\n               Agent {\n                 _events: [Object],\n                 _eventsCount: 1,\n                 _maxListeners: undefined,\n                 defaultPort: 443,\n                 protocol: 'https:',\n                 options: [Object],\n                 requests: {},\n                 sockets: {},\n                 freeSockets: {},\n                 keepAliveMsecs: 1000,\n                 keepAlive: false,\n                 maxSockets: Infinity,\n                 maxFreeSockets: 256,\n                 maxCachedSessions: 100,\n                 _sessionCache: [Object] },\n              Server: { [Function: Server] super_: [Function] },\n              createServer: [Function: createServer],\n              get: [Function: get],\n              request: [Function: request] } },\n        pathname: '/api/addr/mvQPGnzRT6gMWASZBMg7NcT3vmvsSKSQtf',\n        search: '?from=0&to=1000' },\n     _redirectCount: 0,\n     _redirects: [],\n     _requestBodyLength: 0,\n     _requestBodyBuffers: [],\n     _onNativeResponse: [Function],\n     _currentRequest:\n      ClientRequest {\n        _events:\n         [Object: null prototype] {\n           response: { [Function: bound onceWrapper] listener: [Function] },\n           socket: [Function],\n           abort: [Function],\n           aborted: [Function],\n           error: [Function],\n           timeout: [Function] },\n        _eventsCount: 6,\n        _maxListeners: undefined,\n        output: [],\n        outputEncodings: [],\n        outputCallbacks: [],\n        outputSize: 0,\n        writable: true,\n        _last: true,\n        chunkedEncoding: false,\n        shouldKeepAlive: false,\n        useChunkedEncodingByDefault: false,\n        sendDate: false,\n        _removedConnection: false,\n        _removedContLen: false,\n        _removedTE: false,\n        _contentLength: 0,\n        _hasBody: true,\n        _trailer: '',\n        finished: true,\n        _headerSent: true,\n        socket:\n         Socket {\n           connecting: false,\n           _hadError: true,\n           _handle: null,\n           _parent: null,\n           _host: null,\n           _readableState:\n            ReadableState {\n              objectMode: false,\n              highWaterMark: 16384,\n              buffer: BufferList { head: null, tail: null, length: 0 },\n              length: 0,\n              pipes: null,\n              pipesCount: 0,\n              flowing: true,\n              ended: false,\n              endEmitted: false,\n              reading: true,\n              sync: false,\n              needReadable: true,\n              emittedReadable: false,\n              readableListening: false,\n              resumeScheduled: false,\n              paused: false,\n              emitClose: false,\n              autoDestroy: false,\n              destroyed: true,\n              defaultEncoding: 'utf8',\n              awaitDrain: 0,\n              readingMore: false,\n              decoder: null,\n              encoding: null },\n           readable: false,\n           _events:\n            [Object: null prototype] {\n              end: [Function: onReadableStreamEnd],\n              connect: [ [Function], [Function], [Function] ],\n              free: [Function: onFree],\n              close: [ [Function: onClose], [Function: socketCloseListener] ],\n              agentRemove: [Function: onRemove],\n              drain: [Function: ondrain],\n              error: [Function: socketErrorListener] },\n           _eventsCount: 7,\n           _maxListeners: undefined,\n           _writableState:\n            WritableState {\n              objectMode: false,\n              highWaterMark: 16384,\n              finalCalled: false,\n              needDrain: false,\n              ending: false,\n              ended: false,\n              finished: false,\n              destroyed: true,\n              decodeStrings: false,\n              defaultEncoding: 'utf8',\n              length: 191,\n              writing: true,\n              corked: 0,\n              sync: false,\n              bufferProcessing: false,\n              onwrite: [Function: bound onwrite],\n              writecb: [Function: bound onFinish],\n              writelen: 191,\n              bufferedRequest: null,\n              lastBufferedRequest: null,\n              pendingcb: 1,\n              prefinished: false,\n              errorEmitted: true,\n              emitClose: false,\n              autoDestroy: false,\n              bufferedRequestCount: 0,\n              corkedRequestsFree:\n               { next: null,\n                 entry: null,\n                 finish: [Function: bound onCorkedFinish] } },\n           writable: false,\n           allowHalfOpen: false,\n           _sockname: null,\n           _pendingData:\n            'GET /api/addr/mvQPGnzRT6gMWASZBMg7NcT3vmvsSKSQtf?from=0&to=1000 HTTP/1.1\\r\\nAccept: application/json, text/plain, */*\\r\\nUser-Agent: axios/0.19.0\\r\\nHost: 159.203.177.17:3001\\r\\nConnection: close\\r\\n\\r\\n',\n           _pendingEncoding: 'latin1',\n           server: null,\n           _server: null,\n           parser: null,\n           _httpMessage: [Circular],\n           [Symbol(asyncId)]: 1338660460,\n           [Symbol(lastWriteQueueSize)]: 0,\n           [Symbol(timeout)]: null,\n           [Symbol(kBytesRead)]: 0,\n           [Symbol(kBytesWritten)]: 0 },\n        connection:\n         Socket {\n           connecting: false,\n           _hadError: true,\n           _handle: null,\n           _parent: null,\n           _host: null,\n           _readableState:\n            ReadableState {\n              objectMode: false,\n              highWaterMark: 16384,\n              buffer: BufferList { head: null, tail: null, length: 0 },\n              length: 0,\n              pipes: null,\n              pipesCount: 0,\n              flowing: true,\n              ended: false,\n              endEmitted: false,\n              reading: true,\n              sync: false,\n              needReadable: true,\n              emittedReadable: false,\n              readableListening: false,\n              resumeScheduled: false,\n              paused: false,\n              emitClose: false,\n              autoDestroy: false,\n              destroyed: true,\n              defaultEncoding: 'utf8',\n              awaitDrain: 0,\n              readingMore: false,\n              decoder: null,\n              encoding: null },\n           readable: false,\n           _events:\n            [Object: null prototype] {\n              end: [Function: onReadableStreamEnd],\n              connect: [ [Function], [Function], [Function] ],\n              free: [Function: onFree],\n              close: [ [Function: onClose], [Function: socketCloseListener] ],\n              agentRemove: [Function: onRemove],\n              drain: [Function: ondrain],\n              error: [Function: socketErrorListener] },\n           _eventsCount: 7,\n           _maxListeners: undefined,\n           _writableState:\n            WritableState {\n              objectMode: false,\n              highWaterMark: 16384,\n              finalCalled: false,\n              needDrain: false,\n              ending: false,\n              ended: false,\n              finished: false,\n              destroyed: true,\n              decodeStrings: false,\n              defaultEncoding: 'utf8',\n              length: 191,\n              writing: true,\n              corked: 0,\n              sync: false,\n              bufferProcessing: false,\n              onwrite: [Function: bound onwrite],\n              writecb: [Function: bound onFinish],\n              writelen: 191,\n              bufferedRequest: null,\n              lastBufferedRequest: null,\n              pendingcb: 1,\n              prefinished: false,\n              errorEmitted: true,\n              emitClose: false,\n              autoDestroy: false,\n              bufferedRequestCount: 0,\n              corkedRequestsFree:\n               { next: null,\n                 entry: null,\n                 finish: [Function: bound onCorkedFinish] } },\n           writable: false,\n           allowHalfOpen: false,\n           _sockname: null,\n           _pendingData:\n            'GET /api/addr/mvQPGnzRT6gMWASZBMg7NcT3vmvsSKSQtf?from=0&to=1000 HTTP/1.1\\r\\nAccept: application/json, text/plain, */*\\r\\nUser-Agent: axios/0.19.0\\r\\nHost: 159.203.177.17:3001\\r\\nConnection: close\\r\\n\\r\\n',\n           _pendingEncoding: 'latin1',\n           server: null,\n           _server: null,\n           parser: null,\n           _httpMessage: [Circular],\n           [Symbol(asyncId)]: 1338660460,\n           [Symbol(lastWriteQueueSize)]: 0,\n           [Symbol(timeout)]: null,\n           [Symbol(kBytesRead)]: 0,\n           [Symbol(kBytesWritten)]: 0 },\n        _header:\n         'GET /api/addr/mvQPGnzRT6gMWASZBMg7NcT3vmvsSKSQtf?from=0&to=1000 HTTP/1.1\\r\\nAccept: application/json, text/plain, */*\\r\\nUser-Agent: axios/0.19.0\\r\\nHost: 159.203.177.17:3001\\r\\nConnection: close\\r\\n\\r\\n',\n        _onPendingData: [Function: noopPendingOutput],\n        agent:\n         Agent {\n           _events: [Object: null prototype] { free: [Function] },\n           _eventsCount: 1,\n           _maxListeners: undefined,\n           defaultPort: 80,\n           protocol: 'http:',\n           options: { path: null },\n           requests: {},\n           sockets:\n            { '159.203.177.17:3001:':\n               [ [Socket],\n                 [Socket],\n                 [Socket],\n                 [Socket],\n                 [Socket],\n                 [Socket],\n                 [Socket],\n                 [Socket] ] },\n           freeSockets: {},\n           keepAliveMsecs: 1000,\n           keepAlive: false,\n           maxSockets: Infinity,\n           maxFreeSockets: 256 },\n        socketPath: undefined,\n        timeout: undefined,\n        method: 'GET',\n        path:\n         '/api/addr/mvQPGnzRT6gMWASZBMg7NcT3vmvsSKSQtf?from=0&to=1000',\n        _ended: false,\n        res: null,\n        aborted: undefined,\n        timeoutCb: null,\n        upgradeOrConnect: false,\n        parser: null,\n        maxHeadersCount: null,\n        _redirectable: [Circular],\n        [Symbol(isCorked)]: false,\n        [Symbol(outHeadersKey)]:\n         [Object: null prototype] {\n           accept: [ 'Accept', 'application/json, text/plain, */*' ],\n           'user-agent': [ 'User-Agent', 'axios/0.19.0' ],\n           host: [ 'Host', '159.203.177.17:3001' ] } },\n     _currentUrl:\n      'http://159.203.177.17:3001/api/addr/mvQPGnzRT6gMWASZBMg7NcT3vmvsSKSQtf?from=0&to=1000' },\n  response: undefined,\n  isAxiosError: true,\n  toJSON: [Function] }"}
@christroutner christroutner added the Ready Issue is actionable label Jan 17, 2020
@christroutner christroutner added this to Backlog in Rest v2 Jan 17, 2020
@christroutner
Copy link
Author

This issue may be been resolved with PR #550.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready Issue is actionable
Projects
Rest v2
  
Backlog
Development

No branches or pull requests

1 participant