fix(chat-sdk-lark): template uses thread.post instead of webhook-only send - #1754
Open
iroiro147 wants to merge 1 commit into
Open
fix(chat-sdk-lark): template uses thread.post instead of webhook-only send#1754iroiro147 wants to merge 1 commit into
iroiro147 wants to merge 1 commit into
Conversation
… 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>
Contributor
|
@iroiro147 is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Author
|
CI note: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
@larksuite/vercel-chat-adapteris WebSocket-only —handleWebhook()returns HTTP 501 by design.chatSdkChannel().sendrequires 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 viasend(...), it threw: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(...)tothread.post({ markdown: ... })— the adapter-native delivery mechanism that works regardless of transport. Also removesendfrom the destructured surface so new projects don't reach for the webhook-only path.Validation
pnpm fmtpassespnpm typecheckpasses (catalog types unchanged; only template code)thread.postCloses #1753.