Skip to content

Slack event.thread.post(asyncIterable) fails in onAction(...) with team_not_found #313

@ajasingh

Description

@ajasingh

Bug Description

event.thread.post(asyncIterable) works in normal Slack message handlers, but fails in Slack action handlers with team_not_found.

** Disclaimer ** - Report generated by Codex but verified manually 2 times by me personally on noticed behaviour

Steps to Reproduce

Minimal repro

bot.onAction("approve", async (event) => {
const stream = (async function* () {
yield "Hello";
yield " world";
})();

await event.thread?.post(stream);

});

The same event.thread works for plain text:

bot.onAction("approve", async (event) => {
await event.thread?.post("Approval received");
});

And streaming works fine in normal message contexts:

bot.onNewMention(async (thread) => {
const stream = (async function* () {
yield "Hello";
yield " world";
})();

await thread.post(stream);

});

Observed error

Slack returns:

An API error occurred: team_not_found

What seems to be happening

From the built SDK code:

  • ThreadImpl.handleStream() derives Slack stream options from this._currentMessage.raw
  • it sets:
    • recipientUserId = this._currentMessage.author.userId
    • recipientTeamId = raw?.team_id ?? raw?.team

In action callbacks, event.thread is created from the interactive payload, not a normal Slack message payload.

For Slack interactive payloads, raw.team is an object like:

{ "id": "T123", "domain": "..." }

not the team id string.

So the streaming path appears to pass raw.team instead of raw.team.id as recipient_team_id, which causes Slack native streaming to fail with team_not_found.

Expected Behavior

Expected behavior

event.thread.post(asyncIterable) should work in onAction(...) the same way it works in onNewMention(...) / onSubscribedMessage(...).

Actual Behavior

Does not behaviour

Code Sample

Chat SDK Version

4.23.0

Node.js Version

No response

Platform Adapter

Slack

Operating System

macOS

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions