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

Problem sending Binary Data with "Respond to Webhook" #9291

Closed
fjodorsch opened this issue May 2, 2024 · 6 comments
Closed

Problem sending Binary Data with "Respond to Webhook" #9291

fjodorsch opened this issue May 2, 2024 · 6 comments
Labels

Comments

@fjodorsch
Copy link

fjodorsch commented May 2, 2024

Bug Description

Sometimes,
When responding with large Binary Data (> ca. 2 MB) with the "Respond to Webhook" Node
the following Error is logged to the n8n console.

Error: Cannot set headers after they are sent to the client
    at new NodeError (node:internal/errors:405:5)
    at ServerResponse.setHeader (node:_http_outgoing:648:11)
    at ServerResponse.header (/usr/local/lib/node_modules/n8n/node_modules/express/lib/response.js:795:10)
    at ServerResponse.send (/usr/local/lib/node_modules/n8n/node_modules/express/lib/response.js:175:12)
    at ServerResponse.json (/usr/local/lib/node_modules/n8n/node_modules/express/lib/response.js:279:15)
    at Object.sendSuccessResponse (/usr/local/lib/node_modules/n8n/dist/ResponseHelper.js:28:17)
    at /usr/local/lib/node_modules/n8n/dist/WebhookHelpers.js:114:24
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
Error: Premature close
Error with Webhook-Response for execution "3019974": "Premature close"

And if the File were an Image for example it would only load like half way.
Chrome logs:

Failed to load resource: net::ERR_HTTP2_PROTOCOL_ERROR

Workaround:

In the Webhook node, use

  • Respond
    • When Last Node Finishes
  • Response Data
    • First Entry Binary

To Reproduce

Workflow to showcase:

Test.json

Expected behavior

work

Operating System

Official Docker Image running on Ubuntu

n8n Version

1.38.2

Node.js Version

18.19.1

Database

PostgreSQL

Execution mode

main (default)

@netroy
Copy link
Member

netroy commented May 2, 2024

This is likely the same issue we've been trying to fix in #9063.

I've just created a new docker image n8nio/n8n:fix-9291 from that branch.
Can you try switching to this docker image to see if it fixes the issue for you?

@fjodorsch
Copy link
Author

fjodorsch commented May 2, 2024

Ok, I tested it with the Image n8nio/n8n:fix-9291 on my laptop using the same workflow and
it works.

Edit: Only because I didn't use - N8N_DEFAULT_BINARY_DATA_MODE=filesystem

@fjodorsch
Copy link
Author

Wait, I tested it again but with

- N8N_DEFAULT_BINARY_DATA_MODE=filesystem

and it happened again

@netroy
Copy link
Member

netroy commented May 3, 2024

We fixed a race-condition, and we have published a new docker image on the same tag n8nio/n8n:fix-9291.
Can you please pull the docker image again, and check if the issue is resolved for you 🙏🏽 ?

@netroy
Copy link
Member

netroy commented May 7, 2024

#9063 is merged and will be included in the next release tomorrow.

@janober
Copy link
Member

janober commented May 8, 2024

Fix got released with [email protected]

@netroy netroy closed this as completed May 8, 2024
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