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

fs.unlink should probably be fs.unlinkSync #171

Closed
tomcardoso opened this issue Apr 26, 2019 · 1 comment
Closed

fs.unlink should probably be fs.unlinkSync #171

tomcardoso opened this issue Apr 26, 2019 · 1 comment

Comments

@tomcardoso
Copy link

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).

@edsu edsu closed this as completed in 058fa3e Apr 26, 2019
@edsu
Copy link
Owner

edsu commented Apr 26, 2019

Odd, I don't know why nobody has run into that before, and the test suite passes without it. Maybe something with Node versions? At any rate I applied your change.

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

2 participants