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): Account for immediate confirmation request during test webhook creation #8329

Conversation

ivov
Copy link
Contributor

@ivov ivov commented Jan 15, 2024

Some third-party services send a confirmation request immediately on webhook creation - but by the time the confirmation request reaches the server, the test webhook not yet cached, so the confirmation request receives a 404. This PR ensures we register the test webhook before creation at the third-party service.

Tested in-memory and with Redis.

To test manually, log in to Asana using nodeqa in the vault and create a PAT, run pnpm start:tunnel, create an Asana credential, create an Asana trigger (resource is e.g. the numeric ID for a task in the URL), and create a test webhook. Creation should succeed, and user-prompted events should be received.

Report: https://n8nio.slack.com/archives/C04B1GZ4T0U/p1705210902129699

destinationNode,
webhook: cacheableWebhook as IWebhookData,
});
await this.registrations.register(registration);
Copy link
Contributor

Choose a reason for hiding this comment

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

We can now remove this row right? And if it fails, shouldn't we deregister as part of the catch block?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line ensures the static data that was updated during creation makes it into the cache.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it! What about the automated de-registration if it fails?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If registration throws, catch calls deactivateWebhooks where the last line deregisters test webhooks. That was not changed in this PR.

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

cypress bot commented Jan 15, 2024

1 flaky test on run #3767 ↗︎

0 331 5 0 Flakiness 1

Details:

🌳 🖥️ browsers:node18.12.0-chrome107 🤖 ivov 🗃️ e2e/*
Project: n8n Commit: a90382d7f3
Status: Passed Duration: 03:15 💡
Started: Jan 15, 2024 4:04 PM Ended: Jan 15, 2024 4:07 PM
Flakiness  cypress/e2e/29-templates.cy.ts • 1 flaky test

View Output Video

Test Artifacts
Templates > should save template id with the workflow Test Replay Screenshots Video

Review all test suite changes for PR #8329 ↗︎

Copy link
Contributor

✅ All Cypress E2E specs passed

@ivov ivov merged commit 5fbd797 into master Jan 16, 2024
37 checks passed
@ivov ivov deleted the account-for-immediate-confirmation-request-on-test-webhook-creation branch January 16, 2024 08:17
netroy pushed a commit that referenced this pull request Jan 16, 2024
@github-actions github-actions bot mentioned this pull request Jan 16, 2024
@janober
Copy link
Member

janober commented Jan 16, 2024

Got released with n8n@1.24.1

@github-actions github-actions bot mentioned this pull request Jan 17, 2024
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