Title: bug: useRealtimeRun onComplete fires prematurely in self-hosted environment (Traefik + Docker Compose) · Issue #2856 · triggerdotdev/trigger.dev · GitHub
Open Graph Title: bug: useRealtimeRun onComplete fires prematurely in self-hosted environment (Traefik + Docker Compose) · Issue #2856 · triggerdotdev/trigger.dev
X Title: bug: useRealtimeRun onComplete fires prematurely in self-hosted environment (Traefik + Docker Compose) · Issue #2856 · triggerdotdev/trigger.dev
Description: Provide environment information Environment Information System: OS: macOS 15.7 CPU: (36) x64 Intel(R) Xeon(R) W-2191B CPU @ 2.30GHz Memory: 71.57 GB / 128.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 23.6.1 - /Users/
Open Graph Description: Provide environment information Environment Information System: OS: macOS 15.7 CPU: (36) x64 Intel(R) Xeon(R) W-2191B CPU @ 2.30GHz Memory: 71.57 GB / 128.00 GB Shell: 5.9 - /bin/zsh Binaries: Node...
X Description: Provide environment information Environment Information System: OS: macOS 15.7 CPU: (36) x64 Intel(R) Xeon(R) W-2191B CPU @ 2.30GHz Memory: 71.57 GB / 128.00 GB Shell: 5.9 - /bin/zsh Binaries: Node...
Opengraph URL: https://github.com/triggerdotdev/trigger.dev/issues/2856
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"bug: useRealtimeRun onComplete fires prematurely in self-hosted environment (Traefik + Docker Compose)","articleBody":"### Provide environment information\n\n### Environment Information\n#### System:\n OS: macOS 15.7\n CPU: (36) x64 Intel(R) Xeon(R) W-2191B CPU @ 2.30GHz\n Memory: 71.57 GB / 128.00 GB\n Shell: 5.9 - /bin/zsh\n#### Binaries:\n Node: 23.6.1 - /Users/\u003chome\u003e/.nvm/versions/node/v23.6.1/bin/node\n npm: 10.9.2 - /Users/\u003chome\u003e/.nvm/versions/node/v23.6.1/bin/npm\n pnpm: 10.19.0 - /Users/\u003chome\u003e/Library/pnpm/pnpm\n\n### Reproduction Environment\n- Hosting: Self-hosted using the standard Trigger.dev `docker-compose.yml`.\n- Reverse Proxy: Traefik.\n- Hook Config: Using `baseURL` pointing to the Traefik entrypoint for the Trigger API.\n- SDK Versions: `@trigger.dev/sdk@4.3.2`, `@trigger.dev/react-hooks@4.3.2`.\n- Framework: Next.js 16.10.0 / React 19.2.0\n\n### Infrastructure Details\nThe instance is running behind Traefik using the default Docker Compose setup. While the `onComplete` callback fires early, the `run` state returned by the hook _does_ continue to update correctly in the UI as the task progresses, eventually reaching `COMPLETED`. This suggests the realtime connection itself is working, but the logic governing the callback trigger is misfiring in this network environment.\n\n### Describe the bug\n\nWhen using the `useRealtimeRun` hook with a self-hosted Trigger.dev instance, the `onComplete` callback fires immediately upon the first successful data fetch, even if the run is still in an active state (e.g., `EXECUTING`).\n\n\n### Reproduction repo\n\nNone\n\n### To reproduce\n\n### Reproduction Steps\n1. Trigger a task that includes a significant delay (e.g., 5-10 seconds).\n2. Use `useRealtimeRun` in a client component with a `baseURL` and an `onComplete` callback.\n\n```ts\nconst { run } = useRealtimeRun(runId, {\n accessToken: publicToken,\n baseURL: \"https://your-self-hosted-trigger.com\",\n onComplete: (run) =\u003e {\n console.log(\"onComplete called with status:\", run.status);\n }\n });\n```\n\n3. Observe that onComplete is called almost immediately after the component mounts.\n4. Logging the `run` object inside `onComplete` shows `status: \"EXECUTING\"`.### Expected Behavior\n`onComplete` should only be called once the run reaches a terminal state (`COMPLETED`, `FAILED`, `CANCELED`, `CRASHED`).\n### Actual Behavior\n`onComplete` is called immediately with the non-terminal state.\n\n### Additional information\n\nI also checked traefik logs but there were no issues.","author":{"url":"https://github.com/bbreunig","@type":"Person","name":"bbreunig"},"datePublished":"2026-01-09T10:16:16.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/2856/trigger.dev/issues/2856"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:5506ed90-f784-177d-6f3e-2527ef37e515 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AC3C:133E02:3751821:4A27F0F:6964BCCC |
| html-safe-nonce | d2d4d5f4db9add3bbc3748e6504ce51fc375ec553a14fd55854d9fbfeba08d53 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQzNDOjEzM0UwMjozNzUxODIxOjRBMjdGMEY6Njk2NEJDQ0MiLCJ2aXNpdG9yX2lkIjoiNDk1ODM4Njk0Mjk0ODcxOTgyMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 94c1616e74d7b361a74503113319c38cd65b29232d14eb997637384c24f9846a |
| hovercard-subject-tag | issue:3796369099 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/triggerdotdev/trigger.dev/2856/issue_layout |
| twitter:image | https://opengraph.githubassets.com/685396184cd694446c12120157a9e9d7cd115ddddc5e4795280d5309854e5ce1/triggerdotdev/trigger.dev/issues/2856 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/685396184cd694446c12120157a9e9d7cd115ddddc5e4795280d5309854e5ce1/triggerdotdev/trigger.dev/issues/2856 |
| og:image:alt | Provide environment information Environment Information System: OS: macOS 15.7 CPU: (36) x64 Intel(R) Xeon(R) W-2191B CPU @ 2.30GHz Memory: 71.57 GB / 128.00 GB Shell: 5.9 - /bin/zsh Binaries: Node... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bbreunig |
| hostname | github.com |
| expected-hostname | github.com |
| None | 21df671ce2c9f1a16940ccbd3af6cb4f3f12a856929ca7eb1b4aea8e384ea442 |
| turbo-cache-control | no-preview |
| go-import | github.com/triggerdotdev/trigger.dev git https://github.com/triggerdotdev/trigger.dev.git |
| octolytics-dimension-user_id | 95297378 |
| octolytics-dimension-user_login | triggerdotdev |
| octolytics-dimension-repository_id | 572570113 |
| octolytics-dimension-repository_nwo | triggerdotdev/trigger.dev |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 572570113 |
| octolytics-dimension-repository_network_root_nwo | triggerdotdev/trigger.dev |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 5707c685ac172d50a0bdd7533dde4f8aabcf8eef |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width