Facing Intermittent issue while converting html to excel

Hi team. We are facing intermittent issue with conversion from html to excel. Please see below response that we received from aspose. Please note that, It is occuring for same file. Like sometimes I am able to convert and some time get below response, so it is not related to file.

Error: aborted
    at connResetException (node:internal/errors:717:14)
    at TLSSocket.socketCloseListener (node:_http_client:462:19)
    at TLSSocket.emit (node:events:525:35)
    at TLSSocket.emit (node:domain:489:12)
    at /usr/src/app/backend/node_modules/newrelic/lib/shim/shim.js:1313:22
    at LegacyContextManager.runInContext (/usr/src/app/backend/node_modules/newrelic/lib/context-manager/legacy-context-manager.js:59:23)
    at Shim.applySegment (/usr/src/app/backend/node_modules/newrelic/lib/shim/shim.js:1303:25)
    at TLSSocket.wrapper [as emit] (/usr/src/app/backend/node_modules/newrelic/lib/shim/shim.js:1904:17)
    at node:net:322:12
    at TCP.done (node:_tls_wrap:588:7)
    at TCP.callbackTrampoline (node:internal/async_hooks:130:17) {
  code: 'ECONNRESET',
  config: {
    adapter: [Function: httpAdapter],
    transformRequest: { '0': [Function: transformRequest] },
    transformResponse: { '0': [Function: transformResponse] },
    timeout: 0,
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    validateStatus: [Function: validateStatus],
    headers: {
      Accept: 'application/json, text/plain, */*',
      'Content-Type': 'multipart/form-data; boundary=--------------------------750718650824585665771658',
      accept: 'multipart/form-data',
      authorization: 'Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE2OTg3NDE0ODQsImV4cCI6MTY5ODc0NTA4NCwiaXNzIjoiaHR0cHM6Ly9hcGkuYXNwb3NlLmNsb3VkIiwiYXVkIjpbImh0dHBzOi8vYXBpLmFzcG9zZS5jbG91ZC9yZXNvdXJjZXMiLCJhcGkuYmlsbGluZyIsImFwaS5pZGVudGl0eSIsImFwaS5wcm9kdWN0cyIsImFwaS5zdG9yYWdlIl0sImNsaWVudF9pZCI6IjEzY2I1YWE0LWRhMjktNDk0My1iYjJhLTgxZjdiNjUzNDE0MiIsImNsaWVudF9kZWZhdWx0X3N0b3JhZ2UiOiIxY2M4YmI3ZC0yOTEyLTRmNjItYTJiNy0xNTk5MzNiMWYyNDkiLCJjbGllbnRfaWRlbnRpdHlfdXNlcl9pZCI6IjkxODAyMSIsInNjb3BlIjpbImFwaS5iaWxsaW5nIiwiYXBpLmlkZW50aXR5IiwiYXBpLnByb2R1Y3RzIiwiYXBpLnN0b3JhZ2UiXX0.aOwKRXh_y9-bK45BPYPDHVrHRxI9o0h-FNEOs7WZiwiP9GgEvLKwsnKEv7c9zNTNrYJUrM7BTmivQB4g_6mXbcTCduavLBMgyJf46JvmWJ7h88Cdyku7p7hzi5dIQ1gPSnNzytqknl5CtykUZV8jrw4sP8H6PQVtL26bM_wPbGfFCe394fPFFDSNvDpZ5_8dJXL1vr5IRJy649YpvJwHS9Dc7gN1IL0lvbWvgvVw9z6-OUxQLW30WFLGJn0IpSCyU05UwAvbM-eLj4waVHKszNWpPuYTw5kJND7LSpmqk_IwxaWVs55WJ7OTdWngh_-Dw3-4HXDI-b7Sp1lvbx5OTQ',
      'x-aspose-client': 'Containerize.Swagger',
      'User-Agent': 'axios/0.18.1'
    },
    method: 'put',
    url: 'https://api.aspose.cloud/v3.0/cells/convert?format=XLSX&outPath=htmlToExcelFilesData/output-xkpab3.xlsx&checkExcelRestriction=true&streamFormat=html',
    data: FormData {
      _overheadLength: 161,
      _valueLength: 0,
      _valuesToMeasure: [Array],
      writable: false,
      readable: true,
      dataSize: 0,
      maxDataSize: 2097152,
      pauseStreams: true,
      _released: true,
      _streams: [],
      _currentStream: null,
      _insideLoop: false,
      _pendingNext: false,
      _boundary: '--------------------------750718650824585665771658',
      _events: [Object: null prototype] {},
      _eventsCount: 0
    }
  },
  request: <ref *1> ClientRequest {
    _events: [Object: null prototype] {
      abort: [Function (anonymous)],
      aborted: [Function (anonymous)],
      error: [Function (anonymous)],
      socket: [Function (anonymous)],
      timeout: [Function (anonymous)],
      finish: [Function: requestOnFinish]
    },
    _eventsCount: 6,
    _maxListeners: undefined,
    outputData: [],
    outputSize: 0,
    writable: true,
    destroyed: true,
    _last: true,
    chunkedEncoding: true,
    shouldKeepAlive: false,
    maxRequestsOnConnectionReached: false,
    _defaultKeepAlive: true,
    useChunkedEncodingByDefault: true,
    sendDate: false,
    _removedConnection: false,
    _removedContLen: false,
    _removedTE: false,
    strictContentLength: false,
    _contentLength: null,
    _hasBody: true,
    _trailer: '',
    finished: true,
    _headerSent: true,
    _closed: true,
    socket: TLSSocket {
      _tlsOptions: [Object],
      _secureEstablished: true,
      _securePending: false,
      _newSessionPending: false,
      _controlReleased: true,
      secureConnecting: false,
      _SNICallback: null,
      servername: 'api.aspose.cloud',
      alpnProtocol: false,
      authorized: true,
      authorizationError: null,
      encrypted: true,
      _events: [Object: null prototype],
      _eventsCount: 11,
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: 'api.aspose.cloud',
      _closeAfterHandlingError: false,
      _readableState: [ReadableState],
      _maxListeners: undefined,
      _writableState: [WritableState],
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: undefined,
      _server: null,
      ssl: null,
      _requestCert: true,
      _rejectUnauthorized: true,
      emit: [Function: wrapper],
      parser: null,
      _httpMessage: [Circular *1],
      write: [Function: writeAfterFIN],
      [Symbol(res)]: null,
      [Symbol(verified)]: true,
      [Symbol(pendingSession)]: null,
      [Symbol(async_id_symbol)]: 27931,
      [Symbol(kHandle)]: null,
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kCapture)]: false,
      [Symbol(kSetNoDelay)]: false,
      [Symbol(kSetKeepAlive)]: false,
      [Symbol(kSetKeepAliveInitialDelay)]: 0,
      [Symbol(kBytesRead)]: 419,
      [Symbol(kBytesWritten)]: 115662,
      [Symbol(connect-options)]: [Object]
    },
    _header: 'PUT /v3.0/cells/convert?format=XLSX&outPath=htmlToExcelFilesData/output-xkpab3.xlsx&checkExcelRestriction=true&streamFormat=html HTTP/1.1\r\n' +
      'accept: multipart/form-data\r\n' +
      'Content-Type: multipart/form-data; boundary=--------------------------750718650824585665771658\r\n' +
      'authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE2OTg3NDE0ODQsImV4cCI6MTY5ODc0NTA4NCwiaXNzIjoiaHR0cHM6Ly9hcGkuYXNwb3NlLmNsb3VkIiwiYXVkIjpbImh0dHBzOi8vYXBpLmFzcG9zZS5jbG91ZC9yZXNvdXJjZXMiLCJhcGkuYmlsbGluZyIsImFwaS5pZGVudGl0eSIsImFwaS5wcm9kdWN0cyIsImFwaS5zdG9yYWdlIl0sImNsaWVudF9pZCI6IjEzY2I1YWE0LWRhMjktNDk0My1iYjJhLTgxZjdiNjUzNDE0MiIsImNsaWVudF9kZWZhdWx0X3N0b3JhZ2UiOiIxY2M4YmI3ZC0yOTEyLTRmNjItYTJiNy0xNTk5MzNiMWYyNDkiLCJjbGllbnRfaWRlbnRpdHlfdXNlcl9pZCI6IjkxODAyMSIsInNjb3BlIjpbImFwaS5iaWxsaW5nIiwiYXBpLmlkZW50aXR5IiwiYXBpLnByb2R1Y3RzIiwiYXBpLnN0b3JhZ2UiXX0.aOwKRXh_y9-bK45BPYPDHVrHRxI9o0h-FNEOs7WZiwiP9GgEvLKwsnKEv7c9zNTNrYJUrM7BTmivQB4g_6mXbcTCduavLBMgyJf46JvmWJ7h88Cdyku7p7hzi5dIQ1gPSnNzytqknl5CtykUZV8jrw4sP8H6PQVtL26bM_wPbGfFCe394fPFFDSNvDpZ5_8dJXL1vr5IRJy649YpvJwHS9Dc7gN1IL0lvbWvgvVw9z6-OUxQLW30WFLGJn0IpSCyU05UwAvbM-eLj4waVHKszNWpPuYTw5kJND7LSpmqk_IwxaWVs55WJ7OTdWngh_-Dw3-4HXDI-b7Sp1lvbx5OTQ\r\n' +
      'x-aspose-client: Containerize.Swagger\r\n' +
      'User-Agent: axios/0.18.1\r\n' +
      'traceparent: 00-5d3852c38f71559022ba7142ead36827-cbf2ae9585fd0851-01\r\n' +
      'tracestate: 2914910@nr=0-0-3148856-398674974-cbf2ae9585fd0851-6d68c8b3c04bb64e-1-1.824349-1698741545701\r\n' +
      'newrelic: eyJ2IjpbMCwxXSwiZCI6eyJ0eSI6IkFwcCIsImFjIjoiMzE0ODg1NiIsImFwIjoiMzk4Njc0OTc0IiwidHgiOiI2ZDY4YzhiM2MwNGJiNjRlIiwidHIiOiI1ZDM4NTJjMzhmNzE1NTkwMjJiYTcxNDJlYWQzNjgyNyIsInByIjoxLjgyNDM0OSwic2EiOnRydWUsInRpIjoxNjk4NzQxNTQ1NzAxLCJpZCI6ImNiZjJhZTk1ODVmZDA4NTEiLCJ0ayI6IjI5MTQ5MTAifX0=\r\n' +
      'Host: api.aspose.cloud\r\n' +
      'Connection: close\r\n' +
      'Transfer-Encoding: chunked\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: false,
      maxSockets: Infinity,
      maxFreeSockets: 256,
      scheduling: 'lifo',
      maxTotalSockets: Infinity,
      totalSocketCount: 0,
      maxCachedSessions: 100,
      _sessionCache: [Object],
      [Symbol(kCapture)]: false
    },
    socketPath: undefined,
    method: 'PUT',
    maxHeaderSize: undefined,
    insecureHTTPParser: undefined,
    joinDuplicateHeaders: undefined,
    path: '/v3.0/cells/convert?format=XLSX&outPath=htmlToExcelFilesData/output-xkpab3.xlsx&checkExcelRestriction=true&streamFormat=html',
    _ended: false,
    res: IncomingMessage {
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 3,
      _maxListeners: undefined,
      socket: [TLSSocket],
      httpVersionMajor: 1,
      httpVersionMinor: 1,
      httpVersion: '1.1',
      complete: false,
      rawHeaders: [Array],
      rawTrailers: [],
      joinDuplicateHeaders: undefined,
      aborted: true,
      upgrade: false,
      url: '',
      method: null,
      statusCode: 401,
      statusMessage: 'Unauthorized',
      client: [TLSSocket],
      _consuming: true,
      _dumped: false,
      req: [Circular *1],
      responseUrl: 'https://api.aspose.cloud/v3.0/cells/convert?format=XLSX&outPath=htmlToExcelFilesData/output-xkpab3.xlsx&checkExcelRestriction=true&streamFormat=html',
      redirects: [],
      [Symbol(kCapture)]: false,
      [Symbol(kHeaders)]: [Object],
      [Symbol(kHeadersCount)]: 10,
      [Symbol(kTrailers)]: null,
      [Symbol(kTrailersCount)]: 0
    },
    aborted: false,
    timeoutCb: null,
    upgradeOrConnect: false,
    parser: null,
    maxHeadersCount: null,
    reusedSocket: false,
    host: 'api.aspose.cloud',
    protocol: 'https:',
    _redirectable: Writable {
      _writableState: [WritableState],
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      _options: [Object],
      _redirectCount: 0,
      _redirects: [],
      _requestBodyLength: 113840,
      _requestBodyBuffers: [],
      _onNativeResponse: [Function (anonymous)],
      _currentRequest: [Circular *1],
      _currentUrl: 'https://api.aspose.cloud/v3.0/cells/convert?format=XLSX&outPath=htmlToExcelFilesData/output-xkpab3.xlsx&checkExcelRestriction=true&streamFormat=html',
      [Symbol(kCapture)]: false
    },
    [Symbol(kCapture)]: false,
    [Symbol(kBytesWritten)]: 0,
    [Symbol(kNeedDrain)]: true,
    [Symbol(corked)]: 0,
    [Symbol(kOutHeaders)]: [Object: null prototype] {
      accept: [Array],
      'content-type': [Array],
      authorization: [Array],
      'x-aspose-client': [Array],
      'user-agent': [Array],
      traceparent: [Array],
      tracestate: [Array],
      newrelic: [Array],
      host: [Array]
    },
    [Symbol(errored)]: null,
    [Symbol(kUniqueHeaders)]: null
  },
  response: undefined
}

@rajatdpw,
I observed the information you provided and noticed the error code 401, which I suspect is due to an expired access token. Could you clarify how you obtained the access token and how it should be used?

I am making an axios call for getting authorization token. If you see in above response from cloud api, You will be able to see that I am passing token. Using below code.

const configuration = {
    method: 'post',
    url: config.getConfig('ASPOSE_BASE_URL') + '/connect/token',
    headers: { 
      'Content-Type': 'application/x-www-form-urlencoded', 
      'Accept': 'application/json'
    },
    data : data
};

await axios(configuration).then(function (response) {
            accessTokenObj=response.data;
        }).catch(function (error){
            throw error;
        });

then using accessTokenObj.response.access_token in the headers

@rajatdpw,

Thank you for providing the information. I’ll endeavor to reproduce this issue as promptly as possible.

1 Like