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

Media upload action in Matrix plugin does not work #6534

Closed
mprasil opened this issue Jun 23, 2023 · 6 comments
Closed

Media upload action in Matrix plugin does not work #6534

mprasil opened this issue Jun 23, 2023 · 6 comments
Labels

Comments

@mprasil
Copy link

mprasil commented Jun 23, 2023

Describe the bug

Using Matrix node with Resource set to Media fails with:

ERROR: Bad request - please check your parameters
'body' not in content

HTTP code: 400

Stack:

NodeApiError: Bad request - please check your parameters
    at Object.matrixApiRequest (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Matrix/GenericFunctions.js:32:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Matrix/Matrix.node.js:120:38)
    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:652:28)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:596:53

Note that posting regular messages works fine with the same credentials, etc..

To Reproduce
Steps to reproduce the behavior:

  1. Create workflow where one of the steps is Matrix node with Resource set to Media
  2. Click on Execute Node
  3. See error

Expected behavior

Media file uploaded to room.

Environment (please complete the following information):

  • n8n Version 0.231.3
  • Using latest version of image from dockerhub n8nio/n8n:latest
  • Database system SQLite
  • Operation mode own
@Joffcom
Copy link
Member

Joffcom commented Jun 23, 2023

Hey @mprasil,

I have just given this a quick go and it is working for me, Can you share a workflow that reproduces this issue?

image

@mprasil
Copy link
Author

mprasil commented Jun 23, 2023

Thanks for quick response. I think I've figured the issue. The problem seems to be that the previous HTTP request does not return FileName:

image

I think this is because the request is effectively just http://x.x.x.x:8888/. This seems to cause the subsequent Matrix node to fail. I'm able to work around the problem by adding query parameter ?file=/image.jpg that's ignored by server and makes HTTP node to set the filename:

image

I think this is still a bug in Matrix plugin and maybe this situation should be handled in some way?

@Joffcom
Copy link
Member

Joffcom commented Jun 23, 2023

Hey @mprasil,

While I feel like binary data should typically have a filename it seemed easy enough to add in a work around for this in the node, I have popped in a PR which allows you to set a filename or overwrite a filename if needed. Once reviewed it will be merged and available in a future release.

@mprasil
Copy link
Author

mprasil commented Jun 23, 2023

Sometimes data is just data, not a file. HTTP Request is not the only node without file name - for example Create operation of Edit Image node also generates data without name unless you explicitly set it.

PR feels like good solution. Perhaps there could be some additional logic returning some more reasonable error? The error message as it was shown in the interface would never lead me to suspect missing file name if it weren't for your message showing the field in the screen shot.

Anyways, thanks for quick resolution @Joffcom. Really appreciate your help. I can live for now with my HTTP parameter workaround and can switch to setting file name in Matrix node once it is released.

@Joffcom
Copy link
Member

Joffcom commented Jun 23, 2023

Ah I will update the error next time we touch it :) It has been reviewed and approved so should be available in the next release :)

For now I guess I will mark this one as closed, have a good weekend buddy.

@Joffcom Joffcom closed this as completed Jun 23, 2023
@janober
Copy link
Member

janober commented Jul 5, 2023

Fix got released with [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants