Skip to content

ebicsRequest does not handle null data objects in post callback #97

@swimand

Description

@swimand

Issue:
When a response returns as empty, the data.toString('utf-8') throws an error:

const ebicsResponse = response.version(version)(data.toString('utf-8'), keys);

Exception:

TypeError: Cannot read properties of undefined (reading 'toString')
  at processTicksAndRejections (node:internal/process/task_queues:83:21)
  at emitErrorNT (node:internal/streams/destroy:157:8) |  
  |t TLSSocket.emit (node:events:513:28) |  
  at TLSSocket.socketErrorListener (node:_http_client:494:9) |  
  at ClientRequest.emit (node:events:513:28) |  
  at ClientRequest.onRequestEnd (/app/node_modules/rock-req/index.js:76:16) |  
  at /app/node_modules/ebics-client/lib/Client.js:227:59

Solution:

Add a check for if the data is null and either resolve null or reject with a clear message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions