File tree Expand file tree Collapse file tree 8 files changed +21
-66
lines changed
app/api/webhooks/trigger/[path] Expand file tree Collapse file tree 8 files changed +21
-66
lines changed Original file line number Diff line number Diff line change @@ -162,6 +162,15 @@ export async function POST(
162162 if ( foundWebhook . blockId ) {
163163 const blockExists = await blockExistsInDeployment ( foundWorkflow . id , foundWebhook . blockId )
164164 if ( ! blockExists ) {
165+ // For Grain, if block doesn't exist in deployment, treat as verification request
166+ // Grain validates webhook URLs during creation, and the block may not be deployed yet
167+ if ( foundWebhook . provider === 'grain' ) {
168+ logger . info (
169+ `[${ requestId } ] Grain webhook verification - block not in deployment, returning 200 OK`
170+ )
171+ return NextResponse . json ( { status : 'ok' , message : 'Webhook endpoint verified' } )
172+ }
173+
165174 logger . info (
166175 `[${ requestId } ] Trigger block ${ foundWebhook . blockId } not found in deployment for workflow ${ foundWorkflow . id } `
167176 )
Original file line number Diff line number Diff line change @@ -217,12 +217,12 @@ export const GrainBlock: BlockConfig = {
217217 value : ( ) => 'grain_webhook' ,
218218 required : true ,
219219 } ,
220- ...getTrigger ( 'grain_recording_created' ) . subBlocks . slice ( 1 ) ,
221- ...getTrigger ( 'grain_recording_updated' ) . subBlocks . slice ( 1 ) ,
222- ...getTrigger ( 'grain_highlight_created' ) . subBlocks . slice ( 1 ) ,
223- ...getTrigger ( 'grain_highlight_updated' ) . subBlocks . slice ( 1 ) ,
224- ...getTrigger ( 'grain_story_created' ) . subBlocks . slice ( 1 ) ,
225- ...getTrigger ( 'grain_webhook' ) . subBlocks . slice ( 1 ) ,
220+ ...getTrigger ( 'grain_recording_created' ) . subBlocks ,
221+ ...getTrigger ( 'grain_recording_updated' ) . subBlocks ,
222+ ...getTrigger ( 'grain_highlight_created' ) . subBlocks ,
223+ ...getTrigger ( 'grain_highlight_updated' ) . subBlocks ,
224+ ...getTrigger ( 'grain_story_created' ) . subBlocks ,
225+ ...getTrigger ( 'grain_webhook' ) . subBlocks ,
226226 ] ,
227227 tools : {
228228 access : [
Original file line number Diff line number Diff line change 11import { GrainIcon } from '@/components/icons'
22import type { TriggerConfig } from '@/triggers/types'
3- import { buildHighlightOutputs , grainSetupInstructions , grainTriggerOptions } from './utils'
3+ import { buildHighlightOutputs , grainSetupInstructions } from './utils'
44
55export const grainHighlightCreatedTrigger : TriggerConfig = {
66 id : 'grain_highlight_created' ,
@@ -11,15 +11,6 @@ export const grainHighlightCreatedTrigger: TriggerConfig = {
1111 icon : GrainIcon ,
1212
1313 subBlocks : [
14- {
15- id : 'selectedTriggerId' ,
16- title : 'Trigger Type' ,
17- type : 'dropdown' ,
18- mode : 'trigger' ,
19- options : grainTriggerOptions ,
20- value : ( ) => 'grain_highlight_created' ,
21- required : true ,
22- } ,
2314 {
2415 id : 'apiKey' ,
2516 title : 'API Key' ,
Original file line number Diff line number Diff line change 11import { GrainIcon } from '@/components/icons'
22import type { TriggerConfig } from '@/triggers/types'
3- import { buildHighlightOutputs , grainSetupInstructions , grainTriggerOptions } from './utils'
3+ import { buildHighlightOutputs , grainSetupInstructions } from './utils'
44
55export const grainHighlightUpdatedTrigger : TriggerConfig = {
66 id : 'grain_highlight_updated' ,
@@ -11,15 +11,6 @@ export const grainHighlightUpdatedTrigger: TriggerConfig = {
1111 icon : GrainIcon ,
1212
1313 subBlocks : [
14- {
15- id : 'selectedTriggerId' ,
16- title : 'Trigger Type' ,
17- type : 'dropdown' ,
18- mode : 'trigger' ,
19- options : grainTriggerOptions ,
20- value : ( ) => 'grain_highlight_updated' ,
21- required : true ,
22- } ,
2314 {
2415 id : 'apiKey' ,
2516 title : 'API Key' ,
Original file line number Diff line number Diff line change 11import { GrainIcon } from '@/components/icons'
22import type { TriggerConfig } from '@/triggers/types'
3- import { buildRecordingOutputs , grainSetupInstructions , grainTriggerOptions } from './utils'
3+ import { buildRecordingOutputs , grainSetupInstructions } from './utils'
44
55export const grainRecordingCreatedTrigger : TriggerConfig = {
66 id : 'grain_recording_created' ,
@@ -11,15 +11,6 @@ export const grainRecordingCreatedTrigger: TriggerConfig = {
1111 icon : GrainIcon ,
1212
1313 subBlocks : [
14- {
15- id : 'selectedTriggerId' ,
16- title : 'Trigger Type' ,
17- type : 'dropdown' ,
18- mode : 'trigger' ,
19- options : grainTriggerOptions ,
20- value : ( ) => 'grain_recording_created' ,
21- required : true ,
22- } ,
2314 {
2415 id : 'apiKey' ,
2516 title : 'API Key' ,
Original file line number Diff line number Diff line change 11import { GrainIcon } from '@/components/icons'
22import type { TriggerConfig } from '@/triggers/types'
3- import { buildRecordingOutputs , grainSetupInstructions , grainTriggerOptions } from './utils'
3+ import { buildRecordingOutputs , grainSetupInstructions } from './utils'
44
55export const grainRecordingUpdatedTrigger : TriggerConfig = {
66 id : 'grain_recording_updated' ,
@@ -11,15 +11,6 @@ export const grainRecordingUpdatedTrigger: TriggerConfig = {
1111 icon : GrainIcon ,
1212
1313 subBlocks : [
14- {
15- id : 'selectedTriggerId' ,
16- title : 'Trigger Type' ,
17- type : 'dropdown' ,
18- mode : 'trigger' ,
19- options : grainTriggerOptions ,
20- value : ( ) => 'grain_recording_updated' ,
21- required : true ,
22- } ,
2314 {
2415 id : 'apiKey' ,
2516 title : 'API Key' ,
Original file line number Diff line number Diff line change 11import { GrainIcon } from '@/components/icons'
22import type { TriggerConfig } from '@/triggers/types'
3- import { buildStoryOutputs , grainSetupInstructions , grainTriggerOptions } from './utils'
3+ import { buildStoryOutputs , grainSetupInstructions } from './utils'
44
55export const grainStoryCreatedTrigger : TriggerConfig = {
66 id : 'grain_story_created' ,
@@ -11,15 +11,6 @@ export const grainStoryCreatedTrigger: TriggerConfig = {
1111 icon : GrainIcon ,
1212
1313 subBlocks : [
14- {
15- id : 'selectedTriggerId' ,
16- title : 'Trigger Type' ,
17- type : 'dropdown' ,
18- mode : 'trigger' ,
19- options : grainTriggerOptions ,
20- value : ( ) => 'grain_story_created' ,
21- required : true ,
22- } ,
2314 {
2415 id : 'apiKey' ,
2516 title : 'API Key' ,
Original file line number Diff line number Diff line change 11import { GrainIcon } from '@/components/icons'
22import type { TriggerConfig } from '@/triggers/types'
3- import { buildGenericOutputs , grainSetupInstructions , grainTriggerOptions } from './utils'
3+ import { buildGenericOutputs , grainSetupInstructions } from './utils'
44
55export const grainWebhookTrigger : TriggerConfig = {
66 id : 'grain_webhook' ,
@@ -11,15 +11,6 @@ export const grainWebhookTrigger: TriggerConfig = {
1111 icon : GrainIcon ,
1212
1313 subBlocks : [
14- {
15- id : 'selectedTriggerId' ,
16- title : 'Trigger Type' ,
17- type : 'dropdown' ,
18- mode : 'trigger' ,
19- options : grainTriggerOptions ,
20- value : ( ) => 'grain_webhook' ,
21- required : true ,
22- } ,
2314 {
2415 id : 'apiKey' ,
2516 title : 'API Key' ,
You can’t perform that action at this time.
0 commit comments