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

fix(core): Fix empty node execution stack #12945

Merged
merged 1 commit into from
Jan 30, 2025
Merged

Conversation

ivov
Copy link
Contributor

@ivov ivov commented Jan 30, 2025

Context

We have a persistent issue with Cannot read properties of undefined (reading 'node') (see Sentry) originally coming from this line.

This means that in some cases nodeExecutionStack is an empty array, but we always expect it to have at least one node. It turns out that there is an exception, namely an execution where the only node to run is a Chat Trigger is one such case. Ideally there should be no exceptions, but I have no context on whether this exception is necessary.

In #12525 we added a check to catch this case not knowing about this Chat Trigger exception, switching from nodeExecutionStack[0] to nodeExecutionStack.at(0)?. to report it cleanly.

Summary

This PR removes the check but keeps the .at(0)?. optional access to allow this case to go through. See before without check, before with check, and after this PR.

Related Linear tickets, Github issues, and Community forum posts

https://n8nio.sentry.io/issues/6224246597
https://n8nio.sentry.io/issues/6130480643

Review / Merge checklist

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

@ivov ivov added the release/backport Changes that need to be backported to older releases. label Jan 30, 2025
Copy link

codecov bot commented Jan 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 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 Jan 30, 2025
@ivov ivov changed the title fix(core): Fix empty node execution stack fix(core): Fix empty node execution stack for Chat Trigger Jan 30, 2025
@ivov ivov changed the title fix(core): Fix empty node execution stack for Chat Trigger fix(core): Fix empty node execution stack Jan 30, 2025
Copy link
Contributor

⚠️ Some Cypress E2E specs are failing, please fix them before merging

Copy link

cypress bot commented Jan 30, 2025

n8n    Run #9053

Run Properties:  status check passed Passed #9053  •  git commit 7031569a02: 🌳 master 🖥️ browsers:node18.12.0-chrome107 🤖 PR User 🗃️ e2e/*
Project n8n
Branch Review master
Run status status check passed Passed #9053
Run duration 04m 23s
Commit git commit 7031569a02: 🌳 master 🖥️ browsers:node18.12.0-chrome107 🤖 PR User 🗃️ e2e/*
Committer Iván Ovejero
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 2
Tests that did not run due to a developer annotating a test with .skip  Pending 5
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 433
View all changes introduced in this branch ↗︎

Copy link
Contributor

✅ All Cypress E2E specs passed

@ivov ivov merged commit 7031569 into master Jan 30, 2025
39 checks passed
@ivov ivov deleted the fix-empty-node-execution-stack branch January 30, 2025 16:08
@github-actions github-actions bot mentioned this pull request Feb 3, 2025
@github-actions github-actions bot mentioned this pull request Feb 3, 2025
@janober
Copy link
Member

janober commented Feb 3, 2025

Got released with n8n@1.77.1

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 release/backport Changes that need to be backported to older releases. Released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants