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

Received images missing thumbnail kills Node Red #65

Closed
maru-sama opened this issue Jul 21, 2022 · 12 comments
Closed

Received images missing thumbnail kills Node Red #65

maru-sama opened this issue Jul 21, 2022 · 12 comments
Labels
bug Something isn't working

Comments

@maru-sama
Copy link

Good Morning,

I am currently trying out the "Matrix Receive" function with an encrypted Room. Messages work fine and i can see them. But as soon as I sent an image I get the following exception and NR dies.

1 Jul 10:05:04 - [info] [matrix-server-config:Matrix Server] Received encrypted timeline event [m.image]: (FotoTest) @user:host.com :: cat-pet-animal-domestic-104827.jpg
TypeError: Cannot read properties of undefined (reading 'url')
    at MatrixServerNode.<anonymous> (/data/node_modules/node-red-contrib-matrix-chat/src/matrix-receive.js:104:115)
    at MatrixServerNode.emit (node:events:527:28)
    at MatrixServerNode.Node.emit (/usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:188:20)
    at MatrixClient.<anonymous> (/data/node_modules/node-red-contrib-matrix-chat/src/matrix-server-config.js:201:22)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
21 Jul 10:05:04 - [red] Uncaught Exception:
21 Jul 10:05:04 - [error] RuntimeError: abort(TypeError: Cannot read properties of undefined (reading 'url')). Build with -s ASSERTIONS=1 for more info.
    at process.r (/data/node_modules/olm/olm.js:28:55)
    at process.emit (node:events:527:28)
    at emit (node:internal/process/promises:140:20)
    at processPromiseRejections (node:internal/process/promises:274:27)
    at processTicksAndRejections (node:internal/process/task_queues:97:32)
@DimitriosKaltzidis
Copy link

DimitriosKaltzidis commented Aug 18, 2022

The same happens to me as well but only with images not with files. The strange thing is that I have configured the node to accept only m.text on the Timeline event filters and as far as I can see on the code (where the exception is raised) the thumbnail_file must be null for this to happen BUT it should not reach this line as line 99 if(!node.acceptImages) return; should prevent this from happening.

18 Aug 00:04:12 - [info] [matrix-server-config:someconfiguration] Received encrypted timeline event [m.image]: (Encrypted terrorist plot room) @user:host.com :: no wizards.jpg
TypeError: Cannot read properties of undefined (reading 'url')
at MatrixServerNode. (/config/node-red/node_modules/node-red-contrib-matrix-chat/src/matrix-receive.js:104:115)
at MatrixServerNode.emit (node:events:539:35)
at MatrixServerNode.Node.emit (/opt/node_modules/@node-red/runtime/lib/nodes/Node.js:188:20)
at MatrixClient. (/config/node-red/node_modules/node-red-contrib-matrix-chat/src/matrix-server-config.js:201:22)
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5)
18 Aug 00:04:12 - [red] Uncaught Exception:
18 Aug 00:04:12 - [error] RuntimeError: abort(TypeError: Cannot read properties of undefined (reading 'url')). Build with -s ASSERTIONS=1 for more info.
at process.r (/config/node-red/node_modules/olm/olm.js:28:55)
at process.emit (node:events:527:28)
at process.emit (/opt/node_modules/source-map-support/source-map-support.js:516:21)
at emit (node:internal/process/promises:140:20)
at processPromiseRejections (node:internal/process/promises:274:27)
at processTicksAndRejections (node:internal/process/task_queues:97:32)
[00:04:12] WARNING: Node-RED crashed, halting add-on

@skylord123
Copy link
Contributor

Thanks for the report! Definitely looks like something is broken in the code. I will check it out tomorrow after work and report back.

@skylord123
Copy link
Contributor

I'm having trouble replicating this issue. When I set incoming messages to only be text no images come through. I sent multiple .png and .jpg files through an encrypted room and got it coming in on Node-RED correctly.

Maybe these questions will help:

What version of matrix is the server running?
Are you self-hosting this server or is it public?
Are you using the latest version of this package?
What version of Node-RED are you using?

Thanks.

@DimitriosKaltzidis
Copy link

@skylord123 Hi, In my case:

Matrix Synapse 1.65.0,
Self-hosting via cloudron on Ubuntu Focal 20.04 x64
node-red-contrib-matrix-chat 0.6.1 so yes it is the latest version
Node-RED 3.0.2

I hope this helps.

@maru-sama
Copy link
Author

I am also running the latest version of both matrix and node red in docker containers. Interestingly there are files that work and others don't. the crash is always the same though.

nodered_composed | 24 Aug 20:20:36 - [info] [matrix-server-config:Matrix Server] Received encrypted timeline event [m.image]: (FotoTest) @maru:mike.it-loops.com :: Screenshot from 2022-05-18 00-29-02.png
nodered_composed | TypeError: Cannot read properties of undefined (reading 'url')

@skylord123
Copy link
Contributor

I am also running the latest version of both matrix and node red in docker containers. Interestingly there are files that work and others don't. the crash is always the same though.

nodered_composed | 24 Aug 20:20:36 - [info] [matrix-server-config:Matrix Server] Received encrypted timeline event [m.image]: (FotoTest) @maru:mike.it-loops.com :: Screenshot from 2022-05-18 00-29-02.png
nodered_composed | TypeError: Cannot read properties of undefined (reading 'url')

Do you have an image that you can share here that fails? Would help a lot in debugging this. Thanks.

@dbutti
Copy link

dbutti commented Nov 18, 2022

Hi; I've run into this problem as well, and it seems to be related to forwarded media files, which don't have a "file" object under "content". I assume the receive node tries to access "url" under "file", and fails in this case?

Thank-you,

@wuast94
Copy link

wuast94 commented Oct 20, 2023

a friend an d mine have the same problem, so +2

@koosc
Copy link

koosc commented Jun 12, 2024

I also am seeing this. I can get it to happen when it receives an image that was sent using the send image node.

@skylord123
Copy link
Contributor

skylord123 commented Jun 13, 2024

I also am seeing this. I can get it to happen when it receives an image that was sent using the send image node.

Can you provide the error you are getting in your Node-RED log?

EDIT: Believe I found the issue. Looks like if you send an image without a thumbnail this will occur. I'll get this fixed for the next release.

@skylord123 skylord123 added the bug Something isn't working label Jun 13, 2024
@koosc
Copy link

koosc commented Jun 13, 2024

Awesome, thanks! How would a thumbnail be specified? I don't seem to see it as an option for the Send Image node.

@skylord123 skylord123 changed the title Receiving files in an encrypted room kills Node Red Received images missing thumbnail kills Node Red Jun 14, 2024
skylord123 added a commit that referenced this issue Jun 14, 2024
…proved logging) #102

- Fix Received images missing thumbnail kills Node Red #65
- Trim rooms provided in receive node's Room ID config value
@skylord123
Copy link
Contributor

skylord123 commented Jun 14, 2024

Awesome, thanks! How would a thumbnail be specified? I don't seem to see it as an option for the Send Image node.

You actually can't specify a thumbnail on the latest release. You need to use the dev branch on here in order to accomplish that. We actually deprecated the send image node in favor of a single upload file node that can now generate thumbnails for images and videos.

I believe this issue should be resolved now. I made it so the thumbnail is optional now so it should no longer throw an error.

I actually noticed I only added code to generate for videos so I quickly added support for images as well and pushed it up to the dev branch. Give that a try and let me know how it goes. Once I get some more time I will get the release completed and out the door.

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

6 participants