Skip to content

fs.unlink should probably be fs.unlinkSync #171

@tomcardoso

Description

@tomcardoso

Was getting the error below:

fs.js:149 
State changed from up to crashed 
    throw new ERR_INVALID_CALLBACK(cb); 
    ^ 
TypeError [ERR_INVALID_CALLBACK]: Callback must be a function. Received undefined 
    at makeCallback (fs.js:149:11) 
    at Object.unlink (fs.js:996:14) 
    at /app/anon.js:211:16 
    at /app/node_modules/twit/lib/twitter.js:127:13 
    at onRequestComplete (/app/node_modules/twit/lib/twitter.js:352:5) 
    at Request.<anonymous> (/app/node_modules/twit/lib/twitter.js:364:7) 
    at Request.emit (events.js:201:15) 
    at IncomingMessage.<anonymous> (/app/node_modules/request/request.js:1079:12) 
    at Object.onceWrapper (events.js:284:20) 
    at IncomingMessage.emit (events.js:201:15) 
    at endReadableNT (_stream_readable.js:1130:12) 
    at processTicksAndRejections (internal/process/task_queues.js:83:17) 

Per the error, the problem was with line 211, which runs fs.unlink(screenshot). Looks like fs.unlink expects a second param (a callback), so fixed it by changing to fs.unlinkSync(screenshot).

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