-
-
Notifications
You must be signed in to change notification settings - Fork 1k
fix: resolve issues #2900, #2911, #3018, #3020 #3021
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ed41f0a
023c3fd
93aa053
8b684e1
737ad56
c97cbcc
aa90db9
f5ce2bc
8c986db
82f198f
9a3e8d0
e101f8e
d01d438
526e469
954d8fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@trigger.dev/core": patch | ||
| --- | ||
|
|
||
| Fix: ConsoleInterceptor now delegates to original console methods to preserve log chain when other interceptors (like Sentry) are present. (#2900) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@trigger.dev/cli-v3": patch | ||
| --- | ||
|
|
||
| Fix: Native build server failed with Docker Hub rate limits. Added support for checking checking `DOCKER_USERNAME` and `DOCKER_PASSWORD` in environment variables and logging into Docker Hub before building. (#2911) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@trigger.dev/cli-v3": patch | ||
| --- | ||
|
|
||
| Fix: Ignore engine checks during deployment install phase to prevent failure on build server when Node version mismatch exists. (#2913) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@trigger.dev/cli-v3": patch | ||
| --- | ||
|
|
||
| Fix: `trigger.dev dev` command left orphaned worker processes when exited via Ctrl+C (SIGINT). Added signal handlers to ensure proper cleanup of child processes and lockfiles. (#2909) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@trigger.dev/cli-v3": patch | ||
| --- | ||
|
|
||
| Fix Sentry OOM: Allow disabling `source-map-support` via `TRIGGER_SOURCE_MAPS=false`. Also supports `node` for native source maps. (#2920) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # Pull Request: Consolidated Fixes | ||
|
|
||
| ## Title | ||
| fix: consolidated fixes for orphaned workers, Sentry OOM, and Docker Hub rate limits | ||
|
|
||
| ## Description (copy this to GitHub PR) | ||
|
|
||
| ### Summary | ||
| This PR consolidates several bug fixes for the CLI and core packages. | ||
|
|
||
| ### Fixes Included | ||
| - **#2909**: Ensure worker cleanup on SIGINT/SIGTERM to prevent orphaned processes | ||
| - **#2920**: Allow disabling source-map-support to prevent OOM with Sentry | ||
| - **#2913**: Fix GitHub Actions node version compatibility during deploys | ||
| - **#2911**: Authenticate to Docker Hub to prevent rate limits | ||
| - **#2900**: Fix Sentry console log interception | ||
|
|
||
| ### Changes | ||
|
|
||
| #### `packages/cli-v3/src/commands/dev.ts` | ||
| - Added SIGINT/SIGTERM signal handlers for proper worker cleanup on dev server exit | ||
|
|
||
| #### `packages/cli-v3/src/commands/update.ts` | ||
| - Cleaned up incompatible code for better maintainability | ||
|
|
||
| #### `packages/cli-v3/src/cli/common.ts` | ||
| - Added `ignoreEngines` option to CommonCommandOptions schema | ||
|
|
||
| #### `packages/cli-v3/src/commands/login.ts` | ||
| - Fixed missing `ignoreEngines` property in whoAmI calls | ||
|
|
||
| #### `packages/cli-v3/src/entryPoints/dev-run-worker.ts` & `managed-run-worker.ts` | ||
| - Added missing imports: `env`, `normalizeImportPath`, `VERSION`, `promiseWithResolvers` | ||
|
|
||
| #### `packages/core/src/v3/consoleInterceptor.ts` | ||
| - Fixed console interceptor to properly delegate to original methods (Sentry compatibility) | ||
|
|
||
| ### Testing | ||
| - ✅ Local typecheck passes | ||
| - ✅ Unit tests pass for affected packages | ||
|
|
||
| --- | ||
|
|
||
| ## Instructions | ||
|
|
||
| 1. Go to: https://github.com/deepshekhardas/trigger.dev | ||
| 2. Click **"Contribute"** → **"Open pull request"** | ||
| 3. Ensure: | ||
| - Base: `triggerdotdev/trigger.dev` : `main` | ||
| - Compare: `deepshekhardas/trigger.dev` : `main` | ||
| 4. Copy the **Title** above into the PR title field | ||
| 5. Copy the **Description** section above into the PR body | ||
|
Comment on lines
+1
to
+52
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file should not be committed to the repository.
🤖 Prompt for AI Agents |
||
| 6. Click **"Create pull request"** | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,127 @@ | ||||||||||||||||||||||||||||||
| import { describe, test, expect, vi, beforeEach } from "vitest"; | ||||||||||||||||||||||||||||||
| import { RealtimeClient } from "../app/services/realtimeClient.server"; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| // Hoist mocks | ||||||||||||||||||||||||||||||
| const mocks = vi.hoisted(() => ({ | ||||||||||||||||||||||||||||||
| longPollingFetch: vi.fn(), | ||||||||||||||||||||||||||||||
| createRedisClient: vi.fn(() => ({ | ||||||||||||||||||||||||||||||
| defineCommand: vi.fn(), | ||||||||||||||||||||||||||||||
| on: vi.fn(), | ||||||||||||||||||||||||||||||
| })), | ||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| vi.mock("~/utils/longPollingFetch", () => ({ | ||||||||||||||||||||||||||||||
| longPollingFetch: mocks.longPollingFetch, | ||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| vi.mock("~/redis.server", () => ({ | ||||||||||||||||||||||||||||||
| createRedisClient: mocks.createRedisClient, | ||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| vi.mock("../app/services/unkey/redisCacheStore.server", () => ({ | ||||||||||||||||||||||||||||||
| RedisCacheStore: vi.fn(), | ||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| vi.mock("@unkey/cache", () => ({ | ||||||||||||||||||||||||||||||
| createCache: vi.fn(() => ({ | ||||||||||||||||||||||||||||||
| get: vi.fn(), | ||||||||||||||||||||||||||||||
| set: vi.fn(), | ||||||||||||||||||||||||||||||
| })), | ||||||||||||||||||||||||||||||
| DefaultStatefulContext: vi.fn(), | ||||||||||||||||||||||||||||||
| Namespace: vi.fn(), | ||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| // Mock env.server to set the limit to 30 days | ||||||||||||||||||||||||||||||
| vi.mock("~/env.server", () => ({ | ||||||||||||||||||||||||||||||
| env: { | ||||||||||||||||||||||||||||||
| REALTIME_MAXIMUM_CREATED_AT_FILTER_AGE_IN_MS: 30 * 24 * 60 * 60 * 1000, | ||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||
| })); | ||||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+39
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Test relies heavily on mocks and imports The coding guidelines state:
The recommended approach is to refactor As per coding guidelines: "Test files should only import classes and functions from 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| describe("RealtimeClient Filter Logic", () => { | ||||||||||||||||||||||||||||||
| beforeEach(() => { | ||||||||||||||||||||||||||||||
| vi.clearAllMocks(); | ||||||||||||||||||||||||||||||
| mocks.longPollingFetch.mockResolvedValue({ | ||||||||||||||||||||||||||||||
| ok: true, | ||||||||||||||||||||||||||||||
| status: 200, | ||||||||||||||||||||||||||||||
| headers: new Map(), | ||||||||||||||||||||||||||||||
| json: async () => [], | ||||||||||||||||||||||||||||||
| text: async () => "", | ||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||
|
Comment on lines
+44
to
+50
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mock response If Proposed fix mocks.longPollingFetch.mockResolvedValue({
ok: true,
status: 200,
- headers: new Map(),
+ headers: new Headers(),
json: async () => [],
text: async () => "",
});📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| test("should allow createdAt filter > 24h (e.g. 8d)", async () => { | ||||||||||||||||||||||||||||||
| const client = new RealtimeClient({ | ||||||||||||||||||||||||||||||
| electricOrigin: "http://electric", | ||||||||||||||||||||||||||||||
| redis: { host: "localhost", port: 6379, tlsDisabled: true } as any, | ||||||||||||||||||||||||||||||
| keyPrefix: "test", | ||||||||||||||||||||||||||||||
| cachedLimitProvider: { getCachedLimit: async () => 100 }, | ||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| // Request 8 days ago | ||||||||||||||||||||||||||||||
| await client.streamRuns( | ||||||||||||||||||||||||||||||
| "http://remix-app", | ||||||||||||||||||||||||||||||
| { id: "env-1", organizationId: "org-1" }, | ||||||||||||||||||||||||||||||
| { createdAt: "8d" }, | ||||||||||||||||||||||||||||||
| "2024-01-01" | ||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| const callArgs = mocks.longPollingFetch.mock.calls[0]; | ||||||||||||||||||||||||||||||
| const urlToCheck = callArgs[0] as string; | ||||||||||||||||||||||||||||||
| const url = new URL(urlToCheck); | ||||||||||||||||||||||||||||||
| const where = url.searchParams.get("where"); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| // Check for "createdAt" > '...' | ||||||||||||||||||||||||||||||
| const match = where?.match(/"createdAt" > '([^']+)'/); | ||||||||||||||||||||||||||||||
| expect(match).toBeTruthy(); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| const dateStr = match?.[1]; | ||||||||||||||||||||||||||||||
| const date = new Date(dateStr!); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| const now = Date.now(); | ||||||||||||||||||||||||||||||
| const diff = now - date.getTime(); | ||||||||||||||||||||||||||||||
| const days = diff / (24 * 60 * 60 * 1000); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| // It should be close to 8 days. | ||||||||||||||||||||||||||||||
| expect(days).toBeCloseTo(8, 0); // 0 digits precision is enough (e.g. 7.99 or 8.01) | ||||||||||||||||||||||||||||||
| expect(days).toBeGreaterThan(7.9); | ||||||||||||||||||||||||||||||
| expect(days).toBeLessThan(8.1); | ||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| test("should clamp createdAt filter > 30d", async () => { | ||||||||||||||||||||||||||||||
| const client = new RealtimeClient({ | ||||||||||||||||||||||||||||||
| electricOrigin: "http://electric", | ||||||||||||||||||||||||||||||
| redis: { host: "localhost", port: 6379, tlsDisabled: true } as any, | ||||||||||||||||||||||||||||||
| keyPrefix: "test", | ||||||||||||||||||||||||||||||
| cachedLimitProvider: { getCachedLimit: async () => 100 }, | ||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| // Request 60 days ago | ||||||||||||||||||||||||||||||
| await client.streamRuns( | ||||||||||||||||||||||||||||||
| "http://remix-app", | ||||||||||||||||||||||||||||||
| { id: "env-1", organizationId: "org-1" }, | ||||||||||||||||||||||||||||||
| { createdAt: "60d" }, | ||||||||||||||||||||||||||||||
| "2024-01-01" | ||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| const callArgs = mocks.longPollingFetch.mock.calls[0]; | ||||||||||||||||||||||||||||||
| const urlToCheck = callArgs[0] as string; | ||||||||||||||||||||||||||||||
| const url = new URL(urlToCheck); | ||||||||||||||||||||||||||||||
| const where = url.searchParams.get("where"); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| const match = where?.match(/"createdAt" > '([^']+)'/); | ||||||||||||||||||||||||||||||
| expect(match).toBeTruthy(); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| const dateStr = match?.[1]; | ||||||||||||||||||||||||||||||
| const date = new Date(dateStr!); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| const now = Date.now(); | ||||||||||||||||||||||||||||||
| const diff = now - date.getTime(); | ||||||||||||||||||||||||||||||
| const days = diff / (24 * 60 * 60 * 1000); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| // It should be clamped to 30 days. | ||||||||||||||||||||||||||||||
| expect(days).toBeCloseTo(30, 0); | ||||||||||||||||||||||||||||||
| expect(days).toBeGreaterThan(29.9); | ||||||||||||||||||||||||||||||
| expect(days).toBeLessThan(30.1); | ||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # Consolidated Bug Fixes | ||
|
|
||
| This PR combines fixes for several independent issues identified in the codebase, covering CLI stability, deployment/build reliability, and runtime correctness. | ||
|
|
||
| ## Fixes | ||
|
|
||
| | Issue / Feature | Description | | ||
| |-----------------|-------------| | ||
| | **Orphaned Workers** | Fixes `trigger dev` leaving orphaned `trigger-dev-run-worker` processes by ensuring graceful shutdown on `SIGINT`/`SIGTERM` and robust process cleanup. | | ||
| | **Sentry Interception** | Fixes `ConsoleInterceptor` swallowing logs when Sentry (or other monkey-patchers) are present by delegating to the original preserved console methods. | | ||
| | **Engine Strictness** | Fixes deployment failures on GitHub Integration when `engines.node` is strict (e.g. "22") by passing `--no-engine-strict` (and equivalents) during the `trigger deploy` build phase. | | ||
| | **Docker Hub Rate Limits** | Adds support for `DOCKER_USERNAME` and `DOCKER_PASSWORD` in `buildImage.ts` to authenticate with Docker Hub and avoid rate limits during native builds. | | ||
| | **Dead Process Hang** | Fixes a hang in `TaskRunProcess.execute()` by checking specific process connectivity before attempting to send IPC messages. | | ||
| | **Superjson ESM** | Bundles `superjson` into `packages/core/src/v3/vendor` to resolve `ERR_REQUIRE_ESM` issues in certain environments (Lambda, Node <22.12). | | ||
| | **Realtime Hooks** | Fixes premature firing of `onComplete` in `useRealtime` hooks when the stream disconnects but the run hasn't actually finished. | | ||
| | **Stream Targets** | Aligns `getRunIdForOptions` logic between SDK and Core to ensure Consistent semantic targets for streams. | | ||
| | **Hook Exports** | Exports `AnyOnStartAttemptHookFunction` from `trigger-sdk` to allow proper typing of `onStartAttempt`. | | ||
|
|
||
| ## Verification | ||
|
|
||
| ### Automated Verification | ||
| - **Engine Strictness**: Pass in `packages/cli-v3/src/commands/update.test.ts`. | ||
| - **Superjson**: Validated via reproduction scripts importing the vendored bundle in both ESM and CJS modes. | ||
| - **Sentry**: Validated via `repro_2900_sentry.ts` script ensuring logs flow through Sentry patches. | ||
|
|
||
| ### Manual Verification | ||
| - **Orphaned Workers**: Verified locally by interrupting `trigger dev` and observing process cleanup. | ||
| - **Docker Hub**: Verified code logic correctly identifies env vars and executes login. | ||
| - **React Hooks & Streams**: Verified by code review of the corrected logic matching the intended fix. | ||
|
|
||
| ## Changesets | ||
| - `fix-orphaned-workers-2909` | ||
| - `fix-sentry-console-interceptor-2900` | ||
| - `fix-github-install-node-version-2913` | ||
| - `fix-docker-hub-rate-limit-2911` | ||
| - `fix-dead-process-execute-hang` | ||
| - `vendor-superjson-esm-fix` | ||
| - `calm-hooks-wait` | ||
| - `consistent-stream-targets` | ||
| - `export-start-attempt-hook-type` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: "checking checking" — duplicate word.
📝 Committable suggestion
🤖 Prompt for AI Agents