Open10

n8n

toyoshitoyoshi

Railway.appにセルフホストした。 $5で運用できてインストールもクリックだけで終わるので一番コスパいいと思う。動きも特に遅い感じはしない。($5の利用料がもらえるクーポン JrnQBV です。ぜひ使ってください)

テンプレートからn8nを選んでインストールすると自動で動き始める。
変更した点

N8N_EDITOR_BASE_URLをベタ書きにする

これにhttps://がついてないので、OAuthなどが使えなかった。Googleなどの認証で

Access blocked: Authorization Error
You can't sign in to this app because it doesn't comply with Google's OAuth 2.0 policy for keeping apps secure.

とかが出て困った。

TIMEZONEの変数を増やした

サーバサイドでUTCで処理されてしまうので GENERIC_TIMEZONEという変数をAsia/Tokyoにした。 Workerの方の環境設定に加える。

toyoshitoyoshi

デバッグ方法
code or functionノードを使う

return [
  {
    json: {
      endDateTime,
      condition:       (endDateTime > 18),
      typeName: (typeof endDateTime)
    },
  },
];
toyoshitoyoshi

作ったチャットを公開するには、チャットのノードの「Make Chat Publicly Available」をONにする。認証しない、BASIC認証、n8nの認証が選べる。

toyoshitoyoshi

フォームからアップロードしたバイナリを取得したい場合は、フィールド名を直接入力する

toyoshitoyoshi

Slackのインテグレーションメモ

  • Slackアプリを作る
  • n8nでは2つの認証情報が必要(Basic Informationで得られるトークンと、アプリをSlackにインストールした後に見れるようになるOAuth Tokens)
  • チャンネル一覧を表示させるには、channnel:readとgroup:readの権限が必要
  • Event Subscriptionsの方で設定するRequest URLはn8nの方のSlackノードに表示されるWebhookのTest URLを使うが、これはコロコロ変わる(n8nをリロードすると変わる?)ので注意。URLを一度表示したら、[Test Step]の状態にするとVeiricationができる

toyoshitoyoshi

Slackで[Automated with this n8n workflow]というようなフッターが自動で入る。オプションで削除できる。
[Include Link to Workflow]をfalseにすれば良い

toyoshitoyoshi

n8nでNotionノードから取得したデータを動的にドロップダウンの選択肢に設定する方法

目的

n8nのSlackノードなどで使用されるカスタムフォームにおいて、前のノード(ここではNotionノード)から取得した複数のデータを、動的にドロップダウンの選択肢として設定したい。

実際の設定例

以下のJSONをカスタムフォームの定義として使用することで、Notionノードから受け取ったデータを動的にドロップダウンの選択肢として表示できる。

{{
  JSON.stringify([
    {
      "fieldLabel": "選択肢",
      "fieldType": "dropdown",
      "fieldOptions": { 
        "values": $items("Notion").map(item => ({
          "option": item.json.name,
        }))
      },
    "multiselect": true,
      "requiredField": true
    }
  ])
}}
toyoshitoyoshi

Loop over itemsに値を渡すには

return [
	{
		json: {
			url: 'https://medium.com/feed/n8n-io',
		}
	},
	{
		json: {
			url: 'https://dev.to/feed/n8n',
		}
	}
];

のような形式で与える必要がある

toyoshitoyoshi

n8n Slack Trigger Error: "Cannot read properties of undefined (reading 'execute')"

When running n8n with Slack Trigger in Queue Mode (Worker + Main), you may encounter the following error:

Problem with execution: Error: Cannot read properties of undefined (reading 'execute')
TypeError: Cannot read properties of undefined (reading 'execute')
at shouldAssignExecuteMethod (/usr/local/lib/node_modules/n8n/src/utils.ts:88:13)
at NodeTypes.getByNameAndVersion ...
at new Workflow ...
at JobProcessor.processJob ...

This error typically appears only in production (Queue Mode), while test executions work fine.


Root Cause

The error means that the Worker process cannot find the node type (e.g. Slack Trigger).
In Queue Mode, both the Main process and all Workers must have the same node definitions installed.

If the Worker is deployed with a different image or missing dependencies, it will fail to load the Slack node, resulting in execute is undefined.


Solution

  1. Ensure both Main and Worker use the same n8n image/version
    docker pull n8nio/n8n:latest
    docker compose down
    docker compose up -d
    

Redeploy the Worker
If you updated nodes or upgraded n8n, restart/redeploy the Worker containers so they pick up the correct node definitions.

Verify that the Slack Trigger node exists in the n8n UI (Nodes Panel).
If it’s missing, your Worker image might not include n8n-nodes-base.

Example: Fixed by Redeploying the Worker
In my case, the error was resolved simply by redeploying the Worker container with the correct n8n image.
After redeployment, the Slack Trigger started working normally.

Keywords for search
n8n Slack Trigger execute undefined

n8n Worker Queue Mode Cannot read properties of undefined (reading 'execute')

n8n Slack app_mention trigger not working