🔊 Improve http req timeout error
This commit is contained in:
@ -15,7 +15,7 @@ import {
|
||||
} from '@typebot.io/schemas'
|
||||
import { stringify } from 'qs'
|
||||
import { isDefined, isEmpty, isNotDefined, omit } from '@typebot.io/lib'
|
||||
import ky, { HTTPError, Options } from 'ky'
|
||||
import ky, { HTTPError, Options, TimeoutError } from 'ky'
|
||||
import { resumeWebhookExecution } from './resumeWebhookExecution'
|
||||
import { ExecuteIntegrationResponse } from '../../../types'
|
||||
import { parseVariables } from '@typebot.io/variables/parseVariables'
|
||||
@ -250,19 +250,18 @@ export const executeWebhook = async (
|
||||
})
|
||||
return { response, logs, startTimeShouldBeUpdated: true }
|
||||
}
|
||||
if (
|
||||
typeof error === 'object' &&
|
||||
error &&
|
||||
'code' in error &&
|
||||
error.code === 'ETIMEDOUT'
|
||||
) {
|
||||
if (error instanceof TimeoutError) {
|
||||
const response = {
|
||||
statusCode: 408,
|
||||
data: { message: `Request timed out.` },
|
||||
data: {
|
||||
message: `Request timed out. (${(request.timeout ?? 0) / 1000}ms)`,
|
||||
},
|
||||
}
|
||||
logs.push({
|
||||
status: 'error',
|
||||
description: `Webhook request timed out. (${request.timeout}ms)`,
|
||||
description: `Webhook request timed out. (${
|
||||
(request.timeout ?? 0) / 1000
|
||||
}s)`,
|
||||
details: {
|
||||
response,
|
||||
request,
|
||||
|
Reference in New Issue
Block a user