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

Webhook trigger fails when sent a file in multipart/form-data #8249

Closed
pirogoeth opened this issue Jan 6, 2024 · 1 comment · Fixed by #8256
Closed

Webhook trigger fails when sent a file in multipart/form-data #8249

pirogoeth opened this issue Jan 6, 2024 · 1 comment · Fixed by #8256

Comments

@pirogoeth
Copy link

Describe the bug
Some of my workflows expect to receive multipart/form-data payloads that may contain a mixture of fields and files. When a file is received in a webhook body, the webhook node fails:

TypeError: Cannot set properties of undefined (setting 'file')
    at Webhook.handleFormData (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Webhook/Webhook.node.js:210:55)
    at Object.executeWebhook (/usr/local/lib/node_modules/n8n/dist/WebhookHelpers.js:215:33)
    at /usr/local/lib/node_modules/n8n/dist/TestWebhooks.js:91:37

To Reproduce
Steps to reproduce the behavior:

  1. Create a workflow with a single webhook trigger
  2. Listen for test event
  3. curl -v -X POST https://my.n8n.host/webhook-test/478238f3-8119-4b5d-83ab-fbb48bdbe157 -F [email protected] -F field=sometext

Expected behavior

Expected the following behavior as in 1.20.0:
Stock webhook trigger, binary data option on:

  • Fields are dropped from multipart/form-data body
  • Files are stored into binary item

Stock webhook trigger, binary data option off:

  • Fields are placed into $json.body
  • Files are stored into binary item

Environment (please complete the following information):

  • OS: Ubuntu 22.04.3
  • n8n Version: 1.21.0+
  • Node.js Version: 18.18.2
  • Database system SQLite
  • Operation mode: main

All tested versions were from the docker.n8n.io/n8nio/n8n repository

Additional context

It appears that n8n 1.20.0 is the last version to handle mixed-content multipart/form-data webhooks as expected.

Behavior in 1.21.x/1.22.x/1.23.x:
Stock webhook trigger, binary data option on:

  • Fields are dropped from multipart/form-data body
  • Files are stored into binary item

Stock webhook trigger, binary data option off:

  • ERROR: Cannot set properties of undefined (setting 'file')
@paulmeller
Copy link

+1

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

Successfully merging a pull request may close this issue.

2 participants