Cannot convert undefined or null to object at Function.keys when POST datatable editor

Cannot convert undefined or null to object at Function.keys when POST datatable editor

rudobrirudobri Posts: 3Questions: 1Answers: 0

Hi,
I have done the installation of datatable editor on node.js server.
The datatable editor is populated properly (data in...).
I would assume that GET request of api/staff works perfectly but when I try to do an update/edit/delete the POST request is pending and I receive the following error on the server side:

UnhandledPromiseRejectionWarning: TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at Editor.<anonymous> (/root/myapp/node_modules/datatables.net-editor-server/dist/editor.ts:1328:23)
at step (/root/myapp/node_modules/datatables.net-editor-server/dist/editor.js:42:23)
at Object.next (/root/myapp/node_modules/datatables.net-editor-server/dist/editor.js:23:53)
at /root/myapp/node_modules/datatables.net-editor-server/dist/editor.js:17:71
at new Promise (<anonymous>)
at __awaiter (/root/myapp/node_modules/datatables.net-editor-server/dist/editor.js:13:12)
at Editor._process (/root/myapp/node_modules/datatables.net-editor-server/dist/editor.js:1072:16)
at /root/myapp/node_modules/datatables.net-editor-server/dist/editor.ts:664:16
at step (/root/myapp/node_modules/datatables.net-editor-server/dist/editor.js:42:23)
at Object.next (/root/myapp/node_modules/datatables.net-editor-server/dist/editor.js:23:53)
at /root/myapp/node_modules/datatables.net-editor-server/dist/editor.js:17:71
at new Promise (<anonymous>)
at __awaiter (/root/myapp/node_modules/datatables.net-editor-server/dist/editor.js:13:12)
at run (/root/myapp/node_modules/datatables.net-editor-server/dist/editor.js:395:36)
at Editor.<anonymous> (/root/myapp/node_modules/datatables.net-editor-server/dist/editor.ts:676:10)
(node:15953) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 12)

Would you be able to help?
Many thanks.

RB

Answers

  • allanallan Posts: 48,075Questions: 1Answers: 6,907 Site admin

    Editor line 1328 is just an array assignment.

    In the dist directory (although the error message should resolve back through the source map) is a Knex where condition.

    I'm not sure where Function.keys would come into play with either of them.

    Is this using the staff route unmodified? What version of NodeJS are you using and also what version of Knex was installed?

    Thanks,
    Allan

  • rudobrirudobri Posts: 3Questions: 1Answers: 0

    Thanks Allan,
    here is more details:
    knex@0.14.4
    last version of NodeJS;

    I have done a complete fresh new installation of a NodeJs local server using your the exact same format of the demo's controllers. (routes are exactly the same)
    Issue appear on POST requests, could it be that server is not returning JSON answer? Or do I have to create new routes for POST and PUT requests?

    Attached is the latest error I have when I process a POST on api/staff

    'UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: Cannot convert undefined or null to object'

    Just purchased a license and would be great to get it works. :-)

    Thanks for your help.

  • rudobrirudobri Posts: 3Questions: 1Answers: 0

    Thanks allan, found another way around. Regards. RB

  • allanallan Posts: 48,075Questions: 1Answers: 6,907 Site admin

    Great to hear you've got it working. There is a compatibility issue with Knex 0.14 which I've got a fix for - I wonder if it is that which is causing this.

    The demo's should work unmodified! Good to hear you have a workaround for now.

    Allan

  • grapefruitmoongrapefruitmoon Posts: 7Questions: 1Answers: 0

    Hi, any chance you could post your workaround for this? I've got a similar issue.

  • allanallan Posts: 48,075Questions: 1Answers: 6,907 Site admin

    Using Knex 0.13 is one option. The other is to use the head of the Editor / Node libraries. Or hang tight a day or two more until I release 1.7.3 with the fix!

    Allan

  • grapefruitmoongrapefruitmoon Posts: 7Questions: 1Answers: 0

    Thanks Allan - I can wait for the new version. I'm new to Editor...how/where do you usually announce updates?

Sign In or Register to comment.