Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

airtable: Crashes with uncaught exception if payload is missing or invalid #153

Open
ralrom opened this issue Apr 7, 2020 · 0 comments
Open

Comments

@ralrom
Copy link

ralrom commented Apr 7, 2020

Hello, I am using the Airtable node from this package, and noticed that if no payload is specified, this node causes Node-RED to crash with an uncaught exception.

7 Apr 13:01:23 - [red] Uncaught Exception:
util.js:122
7 Apr 13:01:23 - TypeError: Cannot read property 'length' of undefined
    at cleanRecords (<PATH_TO_NODERED_APP>\node_modules\node-red-contrib-viseo-airtable\node-airtable.js:198:15)
    at <PATH_TO_NODERED_APP>\node_modules\node-red-contrib-viseo-airtable\node-airtable.js:137:19
    at <PATH_TO_NODERED_APP>\node_modules\node-red-contrib-viseo-airtable\node_modules\airtable\lib\table.js:99:20
    at Request._callback (<PATH_TO_NODERED_APP>\node_modules\node-red-contrib-viseo-airtable\node_modules\airtable\lib\run_action.js:69:9)
    at Request.self.callback (<PATH_TO_NODERED_APP>\node_modules\request\request.js:185:22)
    at Request.emit (events.js:210:5)
    at Request.<anonymous> (<PATH_TO_NODERED_APP>\node_modules\request\request.js:1161:10)
    at Request.emit (events.js:210:5)
    at IncomingMessage.<anonymous> (<PATH_TO_NODERED_APP>\node_modules\request\request.js:1083:12)
    at Object.onceWrapper (events.js:299:28)
    at IncomingMessage.emit (events.js:215:7)
    at endReadableNT (_stream_readable.js:1184:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)

This error is caused by a call to the function cleanRecords which does a check on records.length before checking if records itself is valid:

if (records.length) {

If records is missing, or does not have a length property, this function throws an exception and stops the Node-RED server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant