Skip to content

Commit 847d803

Browse files
committed
fixed a bug where downstream nodes cant reference values via node id, and a lowercase headers issue
1 parent 58f4676 commit 847d803

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

  • packages

packages/components/nodes/agentflow/Start/Start.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,12 @@ class Start_Agentflow implements INode {
352352

353353
if (startInputType === 'webhookTrigger') {
354354
inputData.webhook = input
355-
let webhookOutput = input
355+
let webhookOutput: string | Record<string, any> = input
356+
try {
357+
webhookOutput = typeof input === 'string' ? JSON.parse(input) : input
358+
} catch (_) {
359+
/* keep as-is */
360+
}
356361
if (options.agentflowRuntime?.webhook && Object.keys(options.agentflowRuntime.webhook).length) {
357362
webhookOutput = options.agentflowRuntime.webhook
358363
}

packages/server/src/services/webhook/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ const validateWebhookChatflow = async (
3434

3535
// Content-Type validation (startsWith handles "application/json; charset=utf-8" variants)
3636
const webhookContentType = startNode?.data?.inputs?.webhookContentType
37-
if (webhookContentType && !headers?.['content-type']?.startsWith(webhookContentType)) {
37+
const incomingContentType = (headers?.['content-type'] ?? '').toLowerCase()
38+
if (webhookContentType && !incomingContentType.startsWith(webhookContentType)) {
3839
throw new InternalFlowiseError(
3940
StatusCodes.UNSUPPORTED_MEDIA_TYPE,
4041
`Content-Type ${headers?.['content-type']} not allowed. Expected ${webhookContentType}`
@@ -44,7 +45,7 @@ const validateWebhookChatflow = async (
4445
// Required header validation
4546
const rawHeaderParams = startNode?.data?.inputs?.webhookHeaderParams
4647
const webhookHeaderParams: Array<{ name: string; required: boolean }> = Array.isArray(rawHeaderParams) ? rawHeaderParams : []
47-
const missingHeaders = webhookHeaderParams.filter((p) => p.required && headers?.[p.name] == null).map((p) => p.name)
48+
const missingHeaders = webhookHeaderParams.filter((p) => p.required && headers?.[p.name.toLowerCase()] == null).map((p) => p.name)
4849
if (missingHeaders.length > 0) {
4950
throw new InternalFlowiseError(StatusCodes.BAD_REQUEST, `Missing required headers: ${missingHeaders.join(', ')}`)
5051
}

0 commit comments

Comments
 (0)