louisgrasset / touitomamout

Touitomamout is an easy way to synchronize your Twitter's tweets 🦤 to Mastodon 🦣 and Bluesky post ☁️ (also known as Twitter to Mastodon & Bluesky crossposter)
https://hub.docker.com/r/louisgrasset/touitomamout
GNU Affero General Public License v3.0
126 stars 7 forks source link

Uncaught undefined in tweet splitter #174

Open QuinnyPig opened 7 months ago

QuinnyPig commented 7 months ago

This was working fine until a few days ago, then it started throwing this trace; any tips on how to figure out what it's choking on / get it to handle the failure gracefully?

│ content-mapper ✔ tweets: total: 14 retweets: 0 replies: 0 quotes: 0 │ │ content-mapper ✔ task finished │ │ TypeError: Cannot read properties of undefined (reading 'matchAll') │ │ at file:///app/dist/helpers/tweet/split-tweet-text/extract-words-and-spacers.js:36:34 │ │ at Array.forEach () │ │ at extractWordsAndSpacers (file:///app/dist/helpers/tweet/split-tweet-text/extract-words-and-spacers.js:35:13) │ │ at splitTweetText (file:///app/dist/helpers/tweet/split-tweet-text/split-tweet-text.js:23:21) │ │ at process.processTicksAndRejections (node:internal/process/task_queues:95:5) │ │ at async makeBlueskyPost (file:///app/dist/helpers/post/make-bluesky-post.js:40:17) │ │ at async makePost (file:///app/dist/helpers/post/make-post.js:29:23) │ │ at async postsSynchronizerService (file:///app/dist/services/posts-synchronizer.service.js:26:70) │ │ at async touitomamout (file:///app/dist/index.js:21:31) │ │ at async file:///app/dist/index.js:33:1 │ │

QuinnyPig commented 7 months ago

A few console.log statements later, and it looks to be a missing catch around an error thrown when a tweet has two links in it. Deleted the tweet and the error stopped.

QuinnyPig commented 7 months ago

I've deleted the tweet, but the newentries object here was:

  {
    str: 'Volkswagen got caught cheating on emissions tests.\n' +
      '\n' +
      'Obviously, someone then created Volkswagen (a CI/CD tool that always passes if in a CI environment). ',
    sep: ''
  },
  { str: 'https://github.com/auchenberg/volkswagen', sep: ' ' },
  {
    str: '\n' +
      '\n' +
      'Then Volkswagen ACTUALLY DID A CI/CD JOINT VENTURE https://www.volkswagen-newsroom.com/en/press-releases/volkswagen-and-tracetronic-establish-neocx-a-joint-venture-for-automated-software-integration-7378',
    sep: ''
  },
  { str: '', sep: '' },
  {
    str: 'https://www.volkswagen-newsroom.com/en/press-releases/volkswagen-and-tracetronic-establish-neocx-a-joint-venture-for-automated-software-integration-7378',
    sep: ''
  },
  { str: undefined, sep: '' }
]

The undefined caused it to choke.