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): Declutter webhook insertion errors #10650

Merged
merged 2 commits into from
Sep 3, 2024

Conversation

ivov
Copy link
Contributor

@ivov ivov commented Sep 3, 2024

In cloud instances it's not uncommon to see webhook insertion errors cluttering startup log. Over time this has come up repeatedly during debugging:

Sample error:

QueryFailedError: SQLITE_CONSTRAINT: UNIQUE constraint failed: webhook_entity.webhookPath, webhook_entity.method
    at Statement.handler (/Users/ivov/Development/n8n/node_modules/.pnpm/@n8n+typeorm@0.3.20-10_@sentry+node@7.87.0_ioredis@5.3.2_mssql@10.0.2_mysql2@3.11.0_pg@8.12.0_dwf5ipxhmlf7bsniwdy2uapm3y/node_modules/src/driver/sqlite/SqliteQueryRunner.ts:137:29) {
  query: 'INSERT INTO "webhook_entity"("workflowId", "webhookPath", "method", "node", "webhookId", "pathLength") VALUES (?, ?, ?, ?, NULL, NULL)',
  parameters: [
    'MBo7OqRrDbalqERS',
    'dbe65803-f138-4772-8698-a9a307623514',
    'GET',
    'Webhook'
  ],
  driverError: [Error: SQLITE_CONSTRAINT: UNIQUE constraint failed: webhook_entity.webhookPath, webhook_entity.method] {
    errno: 19,
    code: 'SQLITE_CONSTRAINT'
  },
  errno: 19,
  code: 'SQLITE_CONSTRAINT'
}

As of 1.15 we no longer deregister webhooks from DB on shutdown, so re-registration on startup causes this line to throw a benign but confusing query failed error, one per registered webhook.

Long-term we should look for a cleaner way to handle webhook de- and re-registration in DB, so that duplicate insertions are only an edge case. For now this PR is meant to help reduce noise when debugging cloud issues.

@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels Sep 3, 2024
Copy link
Contributor

@tomi tomi left a comment

Choose a reason for hiding this comment

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

🚀

Copy link

cypress bot commented Sep 3, 2024

n8n    Run #6725

Run Properties:  status check passed Passed #6725  •  git commit 36177b0943: 🌳 master 🖥️ browsers:node18.12.0-chrome107 🤖 PR User 🗃️ e2e/*
Project n8n
Branch Review master
Run status status check passed Passed #6725
Run duration 04m 53s
Commit git commit 36177b0943: 🌳 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 3
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 423
View all changes introduced in this branch ↗︎

Copy link
Contributor

github-actions bot commented Sep 3, 2024

✅ All Cypress E2E specs passed

@ivov ivov merged commit 36177b0 into master Sep 3, 2024
32 checks passed
@ivov ivov deleted the declutter-webhook-insertion-error branch September 3, 2024 15:58
MiloradFilipovic added a commit that referenced this pull request Sep 5, 2024
* master:
  refactor(RabbitMQ Trigger Node): Improve type-safety, add tests, and fix issues with manual triggers (#10663)
  feat(editor): Add support for nodes with multiple main inputs in new canvas (no-changelog) (#10659)
  fix(editor): Set minimum zoom to 0 to allow fitting very large workflows in new canvas (no-changelog) (#10666)
  feat(editor): Change selection to be default canvas behaviour (no-changelog) (#10668)
  feat: More hints to nodes  (#10565)
  fix(editor): Fix opening executions tab from a new, unsaved workflow (#10652)
  fix(AI Agent Node): Fix tools agent when using memory and Anthropic models (#10513)
  feat(editor): Make highlighted data pane floating (#10638)
  fix(editor): Fix workflow loading after switching to executions view in new canvas (no-changelog) (#10655)
  refactor(benchmark): Separate cloud env provisioning from running benchmarks (#10657)
  feat(core): Implement wrapping of regular nodes as AI Tools (#10641)
  refactor(editor): Remove Trial logic in personalization modal and port to script setup (#10649)
  fix(core): Declutter webhook insertion errors (#10650)
  feat: Reintroduce collaboration feature (#10602)
  feat(benchmark): Add scenario for expressions with Set node (#10647)
  feat(benchmark): Add benchmark scenario for binary files (#10648)
  build: Add `reset` script (#10627)
  feat(editor): Overhaul node insert position computation in new canvas (no-changelog) (#10637)
@github-actions github-actions bot mentioned this pull request Sep 5, 2024
@janober
Copy link
Member

janober commented Sep 5, 2024

Got released with n8n@1.58.0

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.

3 participants