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

UI does not display credentials dropdown when no other parameter is defined in a node #3519

Closed
michal-rogala opened this issue Jun 15, 2022 · 4 comments

Comments

@michal-rogala
Copy link

michal-rogala commented Jun 15, 2022

Describe the bug
When a custom node defines no parameters but requires a credential - node edit window in the UI does not display credential dropdown widget, and a credential cannot be set.

To Reproduce
Create a custom nodes which requires a credential object and which has an empty "properties" array. Node edit window in UI does not display dropdown to choose a credential.

Expected behavior
Node edit UI window displays credentials dropdown

Environment (please complete the following information):

  • OS: [e.g. Ubuntu Linux 18.04] Docker
  • n8n Version [e.g. 0.119.0] 0.181
  • Node.js Version [e.g. 14.16.0] Generic n8n Docker container with added custom node using npm install
  • Database system [e.g. SQLite; n8n uses SQLite as default otherwise changed] SQLite
  • Operation mode [e.g. own; operation modes are own, main and queue. Default is own] own
@Joffcom
Copy link
Member

Joffcom commented Jun 20, 2022

Hey @michal-rogala,

Do you have a small example node that reproduces this?

@michal-rogala
Copy link
Author

michal-rogala commented Jun 22, 2022

This is a small modification of ExampleNode - add credential requirement, remove properties. I've used my custom credential type but I believe any should do.

import { IExecuteFunctions } from 'n8n-core';
import { INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';

export class ExampleNode implements INodeType {
  description: INodeTypeDescription = {
    displayName: 'Keelvar Really Awesome Example Node',
    name: 'exampleNode',
    group: ['transform'],
    version: 1,
    description: 'Basic Example Node',
    defaults: {
      name: 'Example Node',
      color: '#772244',
    },
    inputs: ['main'],
    outputs: ['main'],
    properties: [
    ],
    credentials: [
      {
        name: 'businessAuth',
        required: true,
      },
    ],
  };

  async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
    const items = this.getInputData();

    let item: INodeExecutionData;
    let myString: string;

    // Itterates over all input items and add the key "myString" with the
    // value the parameter "myString" resolves to.
    // (This could be a different value for each item in case it contains an expression)
    for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
      myString = this.getNodeParameter('myString', itemIndex, '') as string;
      item = items[itemIndex];

      item.json['myString'] = myString;
    }

    return this.prepareOutputData(items);
  }
}

@janober
Copy link
Member

janober commented Jun 23, 2022

Thanks a lot for making us aware of it. Got fixed with #3563 and will be released with the next version.

@janober janober closed this as completed Jun 23, 2022
@janober janober added the Upcoming Release Will be part of the upcoming release label Jun 23, 2022
@janober
Copy link
Member

janober commented Jun 29, 2022

Fix got released with n8n@0.184.0

@janober janober removed the Upcoming Release Will be part of the upcoming release label Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants