-
-
Notifications
You must be signed in to change notification settings - Fork 953
Open
Labels
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/<home>/.nvm/versions/node/v23.6.1/bin/node
npm: 10.9.2 - /Users/<home>/.nvm/versions/node/v23.6.1/bin/npm
pnpm: 10.19.0 - /Users/<home>/Library/pnpm/pnpm
Reproduction Environment
- Hosting: Self-hosted using the standard Trigger.dev
docker-compose.yml. - Reverse Proxy: Traefik.
- Hook Config: Using
baseURLpointing to the Traefik entrypoint for the Trigger API. - SDK Versions:
@trigger.dev/sdk@4.3.2,@trigger.dev/react-hooks@4.3.2. - Framework: Next.js 16.10.0 / React 19.2.0
Infrastructure Details
The 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.
Describe the bug
When 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).
Reproduction repo
None
To reproduce
Reproduction Steps
- Trigger a task that includes a significant delay (e.g., 5-10 seconds).
- Use
useRealtimeRunin a client component with abaseURLand anonCompletecallback.
const { run } = useRealtimeRun(runId, {
accessToken: publicToken,
baseURL: "https://your-self-hosted-trigger.com",
onComplete: (run) => {
console.log("onComplete called with status:", run.status);
}
});- Observe that onComplete is called almost immediately after the component mounts.
- Logging the
runobject insideonCompleteshowsstatus: "EXECUTING".### Expected Behavior
onCompleteshould only be called once the run reaches a terminal state (COMPLETED,FAILED,CANCELED,CRASHED).
Actual Behavior
onComplete is called immediately with the non-terminal state.
Additional information
I also checked traefik logs but there were no issues.