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

Error handling RcMessage without the msg field defined #19

Open
drygdryg opened this issue Jul 11, 2024 · 1 comment
Open

Error handling RcMessage without the msg field defined #19

drygdryg opened this issue Jul 11, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@drygdryg
Copy link
Contributor

drygdryg commented Jul 11, 2024

An error occurs when handling messages:

info: Parsing message with ID: ChT2hXQSAC4RfFimX
error: Encountered an error while booting up: TypeError: Cannot read properties of undefined (reading 'includes') Cannot read properties of undefined (reading 'includes') {"stack":"TypeError: Cannot read properties of undefined (reading 'includes')\n    at mapTextMessage (/home/golovanenko.v/git/rocketchat2matrix/dist/handlers/messages.js:56:13)"}

This error occurs here:

if (msg.includes('@all')) {

The problematic message without the msg field:

{
    "_id": "ChT2hXQSAC4RfFimX",
    "_updatedAt": {
        "$date": "2019-09-23T10:39:10.447Z"
    },
    "attachments": [
        {
            "text": "Well, if they are, then you can",
            "author_name": "nucleo",
            "author_icon": "/avatar/nucleo",
            "message_link": "/direct?msg=vWwxtmhkhwZOB8Br4",
            "ts": {
                "$date": "2019-09-23T10:36:32.031Z"
            }
        }
    ],
    "rid": "Zn5ywPXhFkgng6vDq",
    "ts": {
        "$date": "2019-09-23T10:39:10.447Z"
    },
    "u": {
        "_id": "ytJfmk4JD5KDay3Ys",
        "username": "alechka",
        "name": "Alex P."
    }
}

I found 2 similar messages in my Rocket.Chat MongoDB using the query: db.rocketchat_message.find({msg: {$exists: false}})

@HerHde
Copy link
Collaborator

HerHde commented Jul 11, 2024

Thanks for reporting. After a very quick look I'd assume this is indeed some sort of attachment, although I'd expect something like a file link with it (everything without further investigation).
#13 should deal with this, but I didn't had the time to look into it, yet, as I'm finishing tests and parallelisation.

@HerHde HerHde added the bug Something isn't working label Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants