Skip to content

Commit a4eef8b

Browse files
waleedlatif1claude
andcommitted
fix(triggers): resolve type field collision in Notion trigger outputs
Rename nested `type` fields to `entity_type`/`parent_type` to avoid collision with processOutputField's leaf node detection which checks `'type' in field`. Remove spread of author outputs into `authors` array which was overwriting `type: 'array'`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 51236f0 commit a4eef8b

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

apps/sim/triggers/notion/utils.ts

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,6 @@ export function buildNotionExtraFields(triggerId: string): SubBlockConfig[] {
5959
]
6060
}
6161

62-
/**
63-
* Shared author output schema for Notion webhook payloads.
64-
*/
65-
function buildAuthorOutputs(): Record<string, TriggerOutput> {
66-
return {
67-
id: { type: 'string', description: 'Author user ID' },
68-
type: { type: 'string', description: 'Author type (person or bot)' },
69-
}
70-
}
71-
7262
/**
7363
* Base webhook outputs common to all Notion triggers.
7464
*/
@@ -94,7 +84,7 @@ function buildBaseOutputs(): Record<string, TriggerOutput> {
9484
function buildEntityOutputs(): Record<string, TriggerOutput> {
9585
return {
9686
id: { type: 'string', description: 'Entity ID (page or database ID)' },
97-
type: { type: 'string', description: 'Entity type (page or database)' },
87+
entity_type: { type: 'string', description: 'Entity type (page or database)' },
9888
}
9989
}
10090

@@ -107,13 +97,12 @@ export function buildPageEventOutputs(): Record<string, TriggerOutput> {
10797
authors: {
10898
type: 'array',
10999
description: 'Array of users who triggered the event',
110-
...buildAuthorOutputs(),
111100
},
112101
entity: buildEntityOutputs(),
113102
data: {
114103
parent: {
115104
id: { type: 'string', description: 'Parent page or database ID' },
116-
type: { type: 'string', description: 'Parent type (database, page, workspace)' },
105+
parent_type: { type: 'string', description: 'Parent type (database, page, workspace)' },
117106
},
118107
},
119108
}
@@ -128,13 +117,12 @@ export function buildDatabaseEventOutputs(): Record<string, TriggerOutput> {
128117
authors: {
129118
type: 'array',
130119
description: 'Array of users who triggered the event',
131-
...buildAuthorOutputs(),
132120
},
133121
entity: buildEntityOutputs(),
134122
data: {
135123
parent: {
136124
id: { type: 'string', description: 'Parent page or workspace ID' },
137-
type: { type: 'string', description: 'Parent type (page, workspace)' },
125+
parent_type: { type: 'string', description: 'Parent type (page, workspace)' },
138126
},
139127
},
140128
}
@@ -149,16 +137,15 @@ export function buildCommentEventOutputs(): Record<string, TriggerOutput> {
149137
authors: {
150138
type: 'array',
151139
description: 'Array of users who triggered the event',
152-
...buildAuthorOutputs(),
153140
},
154141
entity: {
155142
id: { type: 'string', description: 'Comment ID' },
156-
type: { type: 'string', description: 'Entity type (comment)' },
143+
entity_type: { type: 'string', description: 'Entity type (comment)' },
157144
},
158145
data: {
159146
parent: {
160147
id: { type: 'string', description: 'Parent page ID' },
161-
type: { type: 'string', description: 'Parent type (page)' },
148+
parent_type: { type: 'string', description: 'Parent type (page)' },
162149
},
163150
},
164151
}
@@ -173,7 +160,6 @@ export function buildGenericWebhookOutputs(): Record<string, TriggerOutput> {
173160
authors: {
174161
type: 'array',
175162
description: 'Array of users who triggered the event',
176-
...buildAuthorOutputs(),
177163
},
178164
entity: buildEntityOutputs(),
179165
data: {

0 commit comments

Comments
 (0)