Skip to content

TypeError: Bad argument at CheckInput #4

@kldavis4

Description

@kldavis4

I am having a problem reading data from a database. The table is just a date field and a string field with a JSON object in it. Depending on the date range I select the query returns the data correctly OR I get this error:

/Users/kldavis/.node_libraries/postgres-js/postgres-pure.js:283
var message = first.slice(5, 5 + length);
^
TypeError: Bad argument.
at checkInput (/Users/kldavis/.node_libraries/postgres-js/postgres-pure.js:283:25)
at checkInput (/Users/kldavis/.node_libraries/postgres-js/postgres-pure.js:301:5)
at checkInput (/Users/kldavis/.node_libraries/postgres-js/postgres-pure.js:301:5)
at checkInput (/Users/kldavis/.node_libraries/postgres-js/postgres-pure.js:301:5)
at checkInput (/Users/kldavis/.node_libraries/postgres-js/postgres-pure.js:301:5)
at checkInput (/Users/kldavis/.node_libraries/postgres-js/postgres-pure.js:301:5)
at checkInput (/Users/kldavis/.node_libraries/postgres-js/postgres-pure.js:301:5)
at checkInput (/Users/kldavis/.node_libraries/postgres-js/postgres-pure.js:301:5)
at checkInput (/Users/kldavis/.node_libraries/postgres-js/postgres-pure.js:301:5)
at checkInput (/Users/kldavis/.node_libraries/postgres-js/postgres-pure.js:301:5)

I did a little bit of debugging and determined that the call 'int32read(1)' is returning NaN in this line:

function checkInput() {
if (queue.length === 0) { return; }
var first = queue[0];
var code = String.fromCharCode(first[0]);

var length = first.int32Read(1) - 4; <

I can possibly do some more work trying to figure what in the data is causing this to break, but there probably also needs to be a fix in checkInput to make it a little more robust.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions