Skip to content

Commit

Permalink
fix: add user-agent to the websocket request (#1584)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostdevv authored Jan 7, 2025
1 parent 76a5ac2 commit 4d19dec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/pretty-squids-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"trigger.dev": patch
---

fix: add user-agent to the websocket request
9 changes: 8 additions & 1 deletion packages/cli-v3/src/dev/workerRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { logger } from "../utilities/logger.js";
import { resolveSourceFiles } from "../utilities/sourceFiles.js";
import { BackgroundWorker, BackgroundWorkerCoordinator } from "./backgroundWorker.js";
import { sanitizeEnvVars } from "../utilities/sanitizeEnvVars.js";
import { VERSION } from "../version.js";

export interface WorkerRuntime {
shutdown(): Promise<void>;
Expand Down Expand Up @@ -325,7 +326,13 @@ class DevWorkerRuntime implements WorkerRuntime {
function WebsocketFactory(apiKey: string) {
return class extends wsWebSocket {
constructor(address: string | URL, options?: ClientOptions | ClientRequestArgs) {
super(address, { ...(options ?? {}), headers: { Authorization: `Bearer ${apiKey}` } });
super(address, {
...(options ?? {}),
headers: {
Authorization: `Bearer ${apiKey}`,
"User-Agent": `trigger.dev-cli/${VERSION}`,
},
});
}
};
}
Expand Down

0 comments on commit 4d19dec

Please sign in to comment.