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(Wait Node): Authentication fix #10236

Merged
merged 4 commits into from
Jul 30, 2024
Merged

fix(Wait Node): Authentication fix #10236

merged 4 commits into from
Jul 30, 2024

Conversation

michael-radency
Copy link
Contributor

@michael-radency michael-radency commented Jul 30, 2024

Summary

Authentication for Wait node
Hint to warn about specific of manual execution

Related Linear tickets, Github issues, and Community forum posts

https://linear.app/n8n/issue/NODE-1536/wait-node-authentication

@michael-radency michael-radency added node/improvement New feature or request n8n team Authored by the n8n team node/issue Issue with a node labels Jul 30, 2024
@@ -294,6 +302,29 @@ export class Wait extends Webhook {
default: 'timeInterval',
description: 'Determines the waiting mode to use before the workflow continues',
},
{
Copy link
Member

Choose a reason for hiding this comment

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

there seems to be a bit of duplication between this and the next property. is this because the auth options are more limited here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, we probably should avoid sharing specialized node's properties between different node types as this creates some coupling

@@ -140,8 +140,15 @@ const checkResponseModeConfiguration = (context: IWebhookFunctions) => {
}
};

const authProperty = (nodeType: string) => {
if (nodeType === 'n8n-nodes-base.wait') {
return 'incomingAuthentication';
Copy link
Member

Choose a reason for hiding this comment

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

since this is defined in the node already, could we somehow pick it from there instead ?

Copy link
Member

@netroy netroy left a comment

Choose a reason for hiding this comment

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

We should clean this up at a later point.

const nodeVersion = context.getNode().typeVersion;
export async function formWebhook(
context: IWebhookFunctions,
authProperty = FORM_TRIGGER_AUTHENTICATION_PROPERTY,
Copy link
Member

Choose a reason for hiding this comment

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

This is why I brought up this conversation. If we switch to using class inheritance (instead of the custom style we use), we wouldn't need to pass data around like this, and we could use this.authPropertyName, like we do in Webhook and Wait nodes.

Comment on lines +306 to +319
displayName: 'Authentication',
name: 'incomingAuthentication',
type: 'options',
options: [
{
name: 'Basic Auth',
value: 'basicAuth',
},
{
name: 'None',
value: 'none',
},
],
default: 'none',
Copy link
Member

Choose a reason for hiding this comment

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

we are still duplicating a lot, and the style of this block isn't consistent with the one after this.
The issue with duplication like this is that every time we need to update something in one place, we need to update it in all the copies. And we don't always do that, so we end up with slightly different versions of the same code that later someone else has to clean up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would argue that here it is justifiable as Wait node basically include both Form and Webhook node, and though they have similar properties they are completely different entity, trying too mach reuse code we are tying them together so changes in Webhook would require Form change, which is not what we want

Ideally we want some library of common properties and helpers to setup them, like returnAllOrLimit and helpers to populate options and fixedCollection

Copy link
Member

Choose a reason for hiding this comment

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

What we need is a better way to describe properties, that's type-safe, and allows code reuse without being unintuitive.
Right now we are battling between duplicating code or making code unreadable, and neither is great.

Copy link

cypress bot commented Jul 30, 2024



Test summary

389 0 0 0Flakiness 0


Run details

Project n8n
Status Passed
Commit 3a6c719
Started Jul 30, 2024 12:28 PM
Ended Jul 30, 2024 12:32 PM
Duration 04:40 💡
OS Linux Debian -
Browser Electron 118

View run in Cypress Cloud ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Cloud

Copy link
Contributor

✅ All Cypress E2E specs passed

@michael-radency michael-radency merged commit f87854f into master Jul 30, 2024
30 checks passed
@michael-radency michael-radency deleted the wait-node-auth branch July 30, 2024 12:43
cstuncsik pushed a commit that referenced this pull request Jul 31, 2024
@github-actions github-actions bot mentioned this pull request Jul 31, 2024
@janober
Copy link
Member

janober commented Jul 31, 2024

Got released with n8n@1.53.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
n8n team Authored by the n8n team node/improvement New feature or request node/issue Issue with a node Released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants