🔧 Add disableRequestTimeout param for automation integrations
This commit is contained in:
@@ -41,9 +41,12 @@ export const longReqTimeoutWhitelist = [
|
|||||||
'https://api.anthropic.com',
|
'https://api.anthropic.com',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
type Params = { disableRequestTimeout?: boolean }
|
||||||
|
|
||||||
export const executeWebhookBlock = async (
|
export const executeWebhookBlock = async (
|
||||||
state: SessionState,
|
state: SessionState,
|
||||||
block: WebhookBlock | ZapierBlock | MakeComBlock | PabblyConnectBlock
|
block: WebhookBlock | ZapierBlock | MakeComBlock | PabblyConnectBlock,
|
||||||
|
params: Params = {}
|
||||||
): Promise<ExecuteIntegrationResponse> => {
|
): Promise<ExecuteIntegrationResponse> => {
|
||||||
const logs: ChatLog[] = []
|
const logs: ChatLog[] = []
|
||||||
const webhook =
|
const webhook =
|
||||||
@@ -80,7 +83,7 @@ export const executeWebhookBlock = async (
|
|||||||
response: webhookResponse,
|
response: webhookResponse,
|
||||||
logs: executeWebhookLogs,
|
logs: executeWebhookLogs,
|
||||||
startTimeShouldBeUpdated,
|
startTimeShouldBeUpdated,
|
||||||
} = await executeWebhook(parsedWebhook)
|
} = await executeWebhook(parsedWebhook, params)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...resumeWebhookExecution({
|
...resumeWebhookExecution({
|
||||||
@@ -160,7 +163,8 @@ const parseWebhookAttributes =
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const executeWebhook = async (
|
export const executeWebhook = async (
|
||||||
webhook: ParsedWebhook
|
webhook: ParsedWebhook,
|
||||||
|
params: Params = {}
|
||||||
): Promise<{
|
): Promise<{
|
||||||
response: WebhookResponse
|
response: WebhookResponse
|
||||||
logs?: ChatLog[]
|
logs?: ChatLog[]
|
||||||
@@ -170,9 +174,11 @@ export const executeWebhook = async (
|
|||||||
const { headers, url, method, basicAuth, body, isJson } = webhook
|
const { headers, url, method, basicAuth, body, isJson } = webhook
|
||||||
const contentType = headers ? headers['Content-Type'] : undefined
|
const contentType = headers ? headers['Content-Type'] : undefined
|
||||||
|
|
||||||
const isLongRequest = longReqTimeoutWhitelist.some((whiteListedUrl) =>
|
const isLongRequest = params.disableRequestTimeout
|
||||||
url?.includes(whiteListedUrl)
|
? true
|
||||||
)
|
: longReqTimeoutWhitelist.some((whiteListedUrl) =>
|
||||||
|
url?.includes(whiteListedUrl)
|
||||||
|
)
|
||||||
|
|
||||||
const request = {
|
const request = {
|
||||||
url,
|
url,
|
||||||
|
|||||||
@@ -27,7 +27,9 @@ export const executeIntegration =
|
|||||||
case IntegrationBlockType.MAKE_COM:
|
case IntegrationBlockType.MAKE_COM:
|
||||||
case IntegrationBlockType.PABBLY_CONNECT:
|
case IntegrationBlockType.PABBLY_CONNECT:
|
||||||
return {
|
return {
|
||||||
...(await executeWebhookBlock(state, block)),
|
...(await executeWebhookBlock(state, block, {
|
||||||
|
disableRequestTimeout: true,
|
||||||
|
})),
|
||||||
startTimeShouldBeUpdated: true,
|
startTimeShouldBeUpdated: true,
|
||||||
}
|
}
|
||||||
case IntegrationBlockType.WEBHOOK:
|
case IntegrationBlockType.WEBHOOK:
|
||||||
|
|||||||
Reference in New Issue
Block a user