Skip to content

fix(core): Resolves response promise for active execution on job finished in queue mode #15643

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

Merged
merged 2 commits into from
Jun 4, 2025

Conversation

guillaumejacquart
Copy link
Contributor

@guillaumejacquart guillaumejacquart commented May 23, 2025

Summary

On form submission in scaling mode, when the form trigger is followed by a form page, the second form submit "responsePromise" is never resolved, and the form post thus never resolves.
There is currently a workaround setup in the UI for this that fetches the execution data to know whether the job is finished or not, and update the form UI accordingly. But this comes with issues of its own, like this one: https://linear.app/n8n/issue/NODE-2557/form-node-form-shows-success-when-there-was-an-error

What we want to do is resolve the responsePromise when a form is submitted in queue mode, so that form submission properly finishes, and we can adapt the UI workaround to prevent race conditions: https://github.com/n8n-io/n8n/blob/master/packages/cli/templates/form-trigger.handlebars#L861

I need insights to know if resolving the response promise from the job-finished msg is safe enough though.
Also, we noticed that for webhooks (in queue mode), both messages are listened to ('responde-to-webhook' and 'job-finished'), meaning that the promise will be resolved twice. This seems fine but still..

Related Linear tickets, Github issues, and Community forum posts

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

Copy link

codecov bot commented May 23, 2025

Codecov Report

Attention: Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
packages/cli/src/scaling/scaling.service.ts 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels May 23, 2025
@guillaumejacquart guillaumejacquart marked this pull request as ready for review May 23, 2025 13:30
@guillaumejacquart guillaumejacquart requested a review from netroy May 23, 2025 13:30
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cubic reviewed 1 file and found no issues. Review PR in cubic.dev.

@dana-gill
Copy link
Contributor

This looks okay to me, but I don't have enough context, and I would prefer another engineer more well-versed in core also review this

Copy link
Contributor

@michael-radency michael-radency left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it would work and will break Respond to Webhook node that also require resolving response promise but with actual payload

@Cadiac
Copy link
Contributor

Cadiac commented May 30, 2025

I don't think it would work and will break Respond to Webhook node that also require resolving response promise but with actual payload

Didn't we test this case @guillaumejacquart , and it seemed to behave as expected - in that case code enters the 'respond-to-webhook' path at this switch case which also sends out the payload.

@guillaumejacquart
Copy link
Contributor Author

I don't think it would work and will break Respond to Webhook node that also require resolving response promise but with actual payload

Didn't we test this case @guillaumejacquart , and it seemed to behave as expected - in that case code enters the 'respond-to-webhook' path at this switch case which also sends out the payload.

@michael-radency Yes as @Cadiac said we tested in with respond to webhook node, in which case we also enter the 'respond-to-webhook' case condition and resolve the promise before the job finished: https://github.com/n8n-io/n8n/pull/15643/files#diff-8156178aea8a65acfffdb8b563c9eb8d67261ee667dcdaba54175a64154a8283R304

@michael-radency
Copy link
Contributor

I don't think it would work and will break Respond to Webhook node that also require resolving response promise but with actual payload

Didn't we test this case @guillaumejacquart , and it seemed to behave as expected - in that case code enters the 'respond-to-webhook' path at this switch case which also sends out the payload.

@michael-radency Yes as @Cadiac said we tested in with respond to webhook node, in which case we also enter the 'respond-to-webhook' case condition and resolve the promise before the job finished: https://github.com/n8n-io/n8n/pull/15643/files#diff-8156178aea8a65acfffdb8b563c9eb8d67261ee667dcdaba54175a64154a8283R304

thanks @guillaumejacquart I did manual testing and all seems to work correctly

@ShireenMissi ShireenMissi removed the request for review from dana-gill June 3, 2025 21:01
Copy link
Contributor

@michael-radency michael-radency left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shortstacked
Copy link
Contributor

Workflow Test Results 📊 ⚠️ 4 Warnings (0 Failed), 👍 79 Successful out of 83 total workflows.

View full workflow run

Tested Ref: 812044805663306a4fcf044c82f78634401b5cdc by @michael-radency

⚠️ Warnings (4)

Workflow ID Workflow Name Reason
237 BasicLLMChain:AzureChat Workflow contains new data that previously did not exist.
35 Slack:User:getPresence info:UserProfile:get update... Workflow contains new data that previously did not exist.
48 Asana:Project:getAll get:Task:create update move g... Workflow contains new data that previously did not exist.
257 Agent:auto-fix:anthropic Workflow contains new data that previously did not exist.

Copy link
Contributor

github-actions bot commented Jun 4, 2025

✅ All Cypress E2E specs passed

@guillaumejacquart guillaumejacquart merged commit 7cd7883 into master Jun 4, 2025
35 checks passed
@guillaumejacquart guillaumejacquart deleted the fix-form-submission-resolve-promise branch June 4, 2025 08:25
Alexandero89 pushed a commit to Alexandero89/n8n that referenced this pull request Jun 4, 2025
Alexandero89 pushed a commit to Alexandero89/n8n that referenced this pull request Jun 4, 2025
@janober
Copy link
Member

janober commented Jun 11, 2025

Got released with [email protected]

TianYi0217 pushed a commit to TianYi0217/n8n that referenced this pull request Jun 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team Released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants