Slack Trigger (file_shared) causes “Cannot read properties of undefined (reading ‘channel’)” when channel is selected

Hi n8n team,

I’m using the Slack Trigger node with the file_shared event in n8n Cloud, and encountering the following issue:

Cannot read properties of undefined (reading ‘channel’)

Repro steps:

  1. Add Slack Trigger node
  2. Set event type: file_shared
  3. Select a specific channel in the “Channel to Watch” dropdown (e.g., a public or private channel the bot is in)
  4. Activate workflow
  5. Upload a file in the specified Slack channel

Result:

  • Workflow fails to trigger correctly
  • Execution fails with:Cannot read properties of undefined (reading ‘channel’)

Observations:

  • The file_shared event from Slack does not include a channel field, so attempting to reference it results in this error
  • If I leave the “Channel to Watch” field blank, the workflow works fine across all channels (so this is a viable workaround)
  • This appears to be an internal assumption in the Slack Trigger node logic that breaks when combined with file_shared events

Expected:

  • The workflow should not fail if a channel is selected
  • The trigger should gracefully handle the absence of channel in the payload

Would love to know if a fix or internal check is planned for this case.

Thanks!

1- Leave the “Channel to Watch” field empty for the trigger to work.

2- Add a Function node right after the trigger with this code:
// Only for file_shared events
if ($json.body.event.type === ‘file_shared’) {
const channel = $json.body.event.file.channels?.[0] || null;
return {
event: {
…$json.body.event,
channel,
},
file: $json.body.event.file,
};
}
// For other events, pass the data as is
return $json;

3- In later nodes, replace references to {{ $json.event.channel }} to use the extracted channel within the file object.