Skip to content

fix(chat-sdk-lark): template uses thread.post instead of webhook-only send - #1754

Open
iroiro147 wants to merge 1 commit into
vercel:mainfrom
iroiro147:fix/1753-lark-template-thread-post
Open

fix(chat-sdk-lark): template uses thread.post instead of webhook-only send#1754
iroiro147 wants to merge 1 commit into
vercel:mainfrom
iroiro147:fix/1753-lark-template-thread-post

Conversation

@iroiro147

Copy link
Copy Markdown
Contributor

Problem

The @larksuite/vercel-chat-adapter is WebSocket-only — handleWebhook() returns HTTP 501 by design. chatSdkChannel().send requires the active webhook request context (set only by the chat-sdk HTTP route handler). When the Lark bot received a message over WebSocket and tried to reply via send(...), it threw:

Error: chatSdkChannel().send can only run during a Chat SDK webhook handler for this bridge.

The scaffolded channel could receive messages but could never reply. Reported as #1753.

Fix

Replace the reply path in the generated Lark channel template from send(...) to thread.post({ markdown: ... }) — the adapter-native delivery mechanism that works regardless of transport. Also remove send from the destructured surface so new projects don't reach for the webhook-only path.

Validation

  • pnpm fmt passes
  • pnpm typecheck passes (catalog types unchanged; only template code)
  • Manual: template now compiles and replies via thread.post

Closes #1753.

… send

@larksuite/vercel-chat-adapter is WebSocket-only — its handleWebhook()
returns 501 by design. chatSdkChannel().send requires the webhook request
context, so any reply attempted via send() inside bot.on* throws:
'can only run during a Chat SDK webhook handler'.

Swap the scaffold's reply path to thread.post({ markdown }), which is the
adapter-native delivery mechanism and works regardless of transport. Drop
the webhook-context send from the destructured surface so new projects
don't reach for the broken path.

Closes vercel#1753

Signed-off-by: iroiro147 <sarthak.singh@mastersunion.org>
@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

@iroiro147 is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

@iroiro147

Copy link
Copy Markdown
Contributor Author

CI note: Test TUI smoke tests fails with AI Gateway received no credentials — the test-tui job runs against the real AI Gateway and reads AI_GATEWAY_API_KEY from org secrets, which are not available to workflows triggered from fork PRs (GitHub strips secrets on pull_request events from forks). This is the same infra gap documented on other fork contributions; it is not related to this template change (apps/docs/registry/channels/chat-sdk-lark.ts). Job passes on upstream-owned branches where the secret resolves.

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

Successfully merging this pull request may close these issues.

chat-sdk-lark: generated channel can never reply — chatSdkChannel().send is webhook-only, Lark adapter is WebSocket-only

1 participant