Skip to content

Commit

Permalink
Fix yalt.dev connection timeouts by increasing timeout from 1s to 5s (#…
Browse files Browse the repository at this point in the history
…851)

* Increase the yalt tunnel connection timeout to 5 seconds

* Add changeset
  • Loading branch information
ericallam authored Jan 17, 2024
1 parent f209a3b commit 26f5e77
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/plenty-snails-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@trigger.dev/cli": patch
---

Increase the yalt.dev connection timeout to 5 seconds
10 changes: 9 additions & 1 deletion packages/cli/src/commands/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ async function createNativeTunnel(
https,
{
WebSocket: WebSocket.default,
connectionTimeout: 1000,
connectionTimeout: getConnectionTimeoutValue(),
maxRetries: 10,
},
{ verbose: process.env.TUNNEL_VERBOSE === "1" }
Expand All @@ -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}` });
Expand Down

0 comments on commit 26f5e77

Please sign in to comment.