alexemanuelol / rustplusplus

A NodeJS Discord Bot that uses the rustplus.js library to utilize the power of the Rust+ Companion App with additional Quality-of-Life features.
GNU General Public License v3.0
218 stars 104 forks source link

Bot crash on FcmListener following latests changes #369

Closed bogeux closed 2 months ago

bogeux commented 2 months ago

Hello,

My guess is that it's related to raid alarm, we are facing a crash :

/app/src/util/FcmListener.js:75
        const body = JSON.parse(appData.find(item => item.key === 'body')?.value);
                          ^
SyntaxError: Unexpected token u in JSON at position 0

With data obfuscated being :

{
  id: '5D349187',
  from: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  category: 'org.chromium.linux',
  appData: [
    { key: 'google.source', value: 'webpush' },
    { key: 'encryption', value: 'salt=xxxxxxxxxxxxx==' },
    {
      key: 'subtype',
      value: 'wp:receiver.push.com#xxxxxxxxxxxxxxx'
    },
    {
      key: 'crypto-key',
      value: 'dh=xxxxxxxxxxxxxxxxxxxxxxxxx'
    }
  ],
  persistentId: '0:xxxxxxxxxxxxx%xxxxxxxxxxxxxxxxxxxx',
  ttl: 2419200,
  sent: '1726525812256',
  rawData: <Buffer .......>
}

All variables returns undefined (channel id, ...);

The system runs via docker and the credentials were updated usign the executable on windows.

Thanks for your help.

Marc

bogeux commented 2 months ago

We can refer to https://github.com/liamcottle/atlas-for-rust/blob/c0b9f39901df79d0618746836e290f3e966d1a7d/src/App.vue#L308 which is another project of the dev of rustplus.js. And it seems to be a known behavior which can happend.

alexemanuelol commented 2 months ago

Yea that check would be a nice addition! The error have been reported quite a bit on discord.

alexemanuelol commented 2 months ago

Solved in: ed502845f308029292dd2961c5b94dab2c868d45