Skip to content

TypeError: Cannot read property 'slice' of undefined [bug] #56

Description

@fbeaver

There is a bug in apicontrollerbase.js that can crash the node instance.

var responseObj = JSON.parse(body.slice(1));

If the request body is undefined this will fail.
We experienced this issue which crashed a production server and caused several lost transactions.

Call stack:

at IncomingMessage.emit (events.js:185:15)
at process._tickCallback (internal/process/next_tick.js:178:19)
at endReadableNT (_stream_readable.js:1106:12)
at Object.onceWrapper (events.js:272:13)
at IncomingMessage.<anonymous> (/usr/src/app/node_modules/request/request.js:1079:12)
at Request.emit (events.js:180:13)
TypeError: Cannot read property 'slice' of undefined
at Request._callback (/usr/src/app/node_modules/authorizenet/lib/apicontrollersbase.js:105:39)
at Request.self.callback (/usr/src/app/node_modules/request/request.js:185:22)
at Request.emit (events.js:180:13)
at Request.<anonymous> (/usr/src/app/node_modules/request/request.js:1157:10)
/usr/src/app/node_modules/authorizenet/lib/apicontrollersbase.js:105
var responseObj = JSON.parse(body.slice(1));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions