Creating a n8n app for the first time

Hello, i’m not understanding something or can’t make it works

{
	displayName: 'Code',
	name: 'code',
	type: 'options',
	displayOptions: {
		show: {
			resource: ['---'],
			operation: ['---'],
		},
	},
	typeOptions: {
		loadOptions: {
			routing: {
				request: {
					method: 'GET',
					url: '=/---'
				},
				output: {
					postReceive: [
						{
							type: 'setKeyValue',
							properties: {
								name: '={{$responseItem.label}}',
								value: '={{$responseItem.code}}',
							},
						},
						{
							type: 'sort',
							properties: {
								key: 'name',
							},
						},
					],
				}
			}
		}
	},
	routing: {
		send: {
			type: 'body',
			property: '---',
		},
	},
	default: ''
}

When i do this, i have no result in my select node, it says its empty but if i do this, i can see the first object being output :

{
	type: 'setKeyValue',
	properties: {
		name: '={{$responseItem[0].label}}',
		value: '={{$responseItem[0].code}}',
	},
},
  • n8n version:The last one
  • Database (default: SQLite):SQL
  • n8n EXECUTIONS_PROCESS setting (default: own, main):own
  • Running n8n via (Docker, npm, n8n cloud, desktop app):npm
  • Operating system:Linux

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

I tried to add :

{
	type: 'rootProperty',
	properties: {
		property: '',
	},
},

But it does nothing

Hey @NewUser999,

Welcome to the community :raised_hands:

Have you checked what we do in other nodes that use loadOptions? As an example in the OpenAI node we did this:

{
		displayName: 'Model',
		name: 'model',
		type: 'options',
		description:
			'The model which will generate the completion. <a href="https://beta.openai.com/docs/models/overview">Learn more</a>.',
		displayOptions: {
			show: {
				operation: ['complete'],
				resource: ['text'],
			},
		},
		typeOptions: {
			loadOptions: {
				routing: {
					request: {
						method: 'GET',
						url: '/v1/models',
					},
					output: {
						postReceive: [
							{
								type: 'rootProperty',
								properties: {
									property: 'data',
								},
							},
							{
								type: 'filter',
								properties: {
									pass: "={{ !$responseItem.id.startsWith('audio-') && ($responseItem.id === 'gpt-3.5-turbo-instruct' || !$responseItem.id.startsWith('gpt-') ) && !$responseItem.id.startsWith('dall-') && !$responseItem.id.startsWith('tts-') && !$responseItem.id.startsWith('whisper-') && !['cushman:2020-05-03', 'davinci-if:3.0.0', 'davinci-instruct-beta:2.0.0', 'if'].includes($responseItem.id) && !$responseItem.id.includes('-edit-') && !$responseItem.id.endsWith(':001') }}",
								},
							},
							{
								type: 'setKeyValue',
								properties: {
									name: '={{$responseItem.id}}',
									value: '={{$responseItem.id}}',
								},
							},
							{
								type: 'sort',
								properties: {
									key: 'name',
								},
							},
						],
					},
				},
			},
		},
		routing: {
			send: {
				type: 'body',
				property: 'model',
			},
		},
		default: 'gpt-3.5-turbo-instruct',
	},

I suspect in your case it could be the API response that is causing an issue, Which API are you trying to use?

Hi, yes, i did check.

I figured out my problem, i was bypassing my credentials api token in the main node file.

I had misconfigured the file. I didn’t had those problem with others requests only because i added in my main node file my api key in the requestDefaults.

Once i figured it out, it started to work. But I don’t use anymore loadOptions, i’m using loadOptionsMethod.

Now i need to find out how to make my application available to others.

1 Like

Hey @NewUser999,

To make it available to others you can publish the node to NPM using the npm publish command.

It doesnt need to be pull request by n8n ?

I want it seen and available to everyone, like we have in activepieces, make and zappier.

Hey @NewUser999,

It would need to be a community node, We are not currently accepting new nodes in PRs instead we pick them from the community list based on community feedback and the anonymous telemetry we get.

Thanks for your fast reply.

I did it, it seems working fine.

Just need to adjust my trigger file, they don’t seem to be publish with my actions.

Thanks you again.

1 Like

I might have a last question please @Jon,

When i try my n8n node in local, i see my Trigger and Actions and can use them, but once it’s npm publish i don’t see anymore my trigger.

Hello @Jon ,

I have fixed all my problems, but it remains one, i have my package in my n8n instance, but when i update my package, it seems it doesnt update my n8n package.

If i install my n8n package in a new n8n instance, it will work.

It looks like n8n doesn’t clean the cache or update the package.

It mainly about uppercase, i was using WedofApi for the credentials and when i updated it to wedofApi, n8n doesnt notice the change and i have some errors.