@@ -15,7 +15,7 @@ import {
15
15
} from '@typebot.io/schemas'
16
16
import { stringify } from 'qs'
17
17
import { isDefined , isEmpty , isNotDefined , omit } from '@typebot.io/lib'
18
- import ky , { HTTPError , Options } from 'ky'
18
+ import ky , { HTTPError , Options , TimeoutError } from 'ky'
19
19
import { resumeWebhookExecution } from './resumeWebhookExecution'
20
20
import { ExecuteIntegrationResponse } from '../../../types'
21
21
import { parseVariables } from '@typebot.io/variables/parseVariables'
@@ -250,19 +250,18 @@ export const executeWebhook = async (
250
250
} )
251
251
return { response, logs, startTimeShouldBeUpdated : true }
252
252
}
253
- if (
254
- typeof error === 'object' &&
255
- error &&
256
- 'code' in error &&
257
- error . code === 'ETIMEDOUT'
258
- ) {
253
+ if ( error instanceof TimeoutError ) {
259
254
const response = {
260
255
statusCode : 408 ,
261
- data : { message : `Request timed out.` } ,
256
+ data : {
257
+ message : `Request timed out. (${ ( request . timeout ?? 0 ) / 1000 } ms)` ,
258
+ } ,
262
259
}
263
260
logs . push ( {
264
261
status : 'error' ,
265
- description : `Webhook request timed out. (${ request . timeout } ms)` ,
262
+ description : `Webhook request timed out. (${
263
+ ( request . timeout ?? 0 ) / 1000
264
+ } s)`,
266
265
details : {
267
266
response,
268
267
request,
0 commit comments