makara-filip / ts-messenger-api

The unofficial API for FB Messenger communication
MIT License
50 stars 13 forks source link

I keep getting a "no such file" error after sending a message #9

Closed neptunecorsiva closed 3 years ago

neptunecorsiva commented 3 years ago

After sending a message, I get an error that a .json file is missing.

info login Logging in...
info login Redirected to https:\/\/www.facebook.com\/
info login Logged in
info login Request to reconnect
info login Done logging in.
node:events:342
      throw er; // Unhandled 'error' event
      ^

Error: ENOENT: no such file or directory, open './extracts/incomingAttachments/2021-05-29T15-03-44.927Z.json'
    at Object.openSync (node:fs:583:3)
    at Object.writeFileSync (node:fs:2144:35)
    at Object.parseDelta (C:\Users\namehere\Desktop\Node\fbchatbot\node_modules\ts-messenger-api\dist\lib\formatting\incomingMessageFormatters.js:23:18)
    at MqttClient.<anonymous> (C:\Users\namehere\Desktop\Node\fbchatbot\node_modules\ts-messenger-api\dist\lib\api.js:272:78)
    at MqttClient.emit (node:events:365:28)
    at Arguments.<anonymous> (C:\Users\namehere\Desktop\Node\fbchatbot\node_modules\mqtt\lib\client.js:1265:27)
    at Object.MqttClient.options.customHandleAcks (C:\Users\namehere\Desktop\Node\fbchatbot\node_modules\mqtt\lib\client.js:183:150)
    at MqttClient._handlePublish (C:\Users\namehere\Desktop\Node\fbchatbot\node_modules\mqtt\lib\client.js:1258:15)
    at MqttClient._handlePacket (C:\Users\namehere\Desktop\Node\fbchatbot\node_modules\mqtt\lib\client.js:410:12)
    at work (C:\Users\namehere\Desktop\Node\fbchatbot\node_modules\mqtt\lib\client.js:321:12)
Emitted 'error' event at:
    at MqttClient.<anonymous> (C:\Users\namehere\Desktop\Node\fbchatbot\node_modules\ts-messenger-api\dist\lib\api.js:275:55)
    at MqttClient.emit (node:events:365:28)
    [... lines matching original stack trace ...]
    at work (C:\Users\namehere\Desktop\Node\fbchatbot\node_modules\mqtt\lib\client.js:321:12)
    at Writable.writable._write (C:\Users\namehere\Desktop\Node\fbchatbot\node_modules\mqtt\lib\client.js:335:5)
    at doWrite (C:\Users\namehere\Desktop\Node\fbchatbot\node_modules\readable-stream\lib\_stream_writable.js:409:139)
    at writeOrBuffer (C:\Users\namehere\Desktop\Node\fbchatbot\node_modules\readable-stream\lib\_stream_writable.js:398:5) {
  errno: -4058,
  syscall: 'open',
  code: 'ENOENT',
  path: './extracts/incomingAttachments/2021-05-29T15-03-44.927Z.json'
}

EDIT: So I went ahead and created the folder /extracts/incomingAttachments/ and it stopped giving me the error. Am I supposed to do that?

makara-filip commented 3 years ago

Thanks for submitting this bug. We use the "extracts" folder to store HTTP or websocket responses for analyzing purposes, but it shouldn't be in the package.

It's fixed now. Try to install the latest version of API from NPM to avoid this problem.

neptunecorsiva commented 3 years ago

That seemed to have fixed it, thanks!