From 26f5e7774db6ec519c29f4f4c5bd4ec47c7da12c Mon Sep 17 00:00:00 2001 From: Eric Allam Date: Wed, 17 Jan 2024 10:27:57 +0000 Subject: [PATCH] Fix yalt.dev connection timeouts by increasing timeout from 1s to 5s (#851) * Increase the yalt tunnel connection timeout to 5 seconds * Add changeset --- .changeset/plenty-snails-smile.md | 5 +++++ packages/cli/src/commands/dev.ts | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 .changeset/plenty-snails-smile.md diff --git a/.changeset/plenty-snails-smile.md b/.changeset/plenty-snails-smile.md new file mode 100644 index 0000000000..bb0875729d --- /dev/null +++ b/.changeset/plenty-snails-smile.md @@ -0,0 +1,5 @@ +--- +"@trigger.dev/cli": patch +--- + +Increase the yalt.dev connection timeout to 5 seconds diff --git a/packages/cli/src/commands/dev.ts b/packages/cli/src/commands/dev.ts index bb1a6a3876..bab4ab030b 100644 --- a/packages/cli/src/commands/dev.ts +++ b/packages/cli/src/commands/dev.ts @@ -542,7 +542,7 @@ async function createNativeTunnel( https, { WebSocket: WebSocket.default, - connectionTimeout: 1000, + connectionTimeout: getConnectionTimeoutValue(), maxRetries: 10, }, { verbose: process.env.TUNNEL_VERBOSE === "1" } @@ -557,6 +557,14 @@ async function createNativeTunnel( } } +function getConnectionTimeoutValue() { + if (typeof process.env.TUNNEL_CONNECTION_TIMEOUT === "string") { + return parseInt(process.env.TUNNEL_CONNECTION_TIMEOUT); + } + + return 5000; +} + async function createNgrokTunnel(hostname: string, port: number, spinner: Ora) { try { return await ngrok.connect({ addr: `${hostname}:${port}` });