Repository navigation
Closed
Description
Provide environment information
System:
OS: Linux 6.8 Ubuntu 24.04.1 LTS 24.04.1 LTS (Noble Numbat)
CPU: (8) x64 Intel(R) Xeon(R) CPU E3-1230 v3 @ 3.30GHz
Memory: 14.35 GB / 31.29 GB
Container: Yes
Shell: 5.2.21 - /bin/bash
Binaries:
Node: 18.19.1 - /usr/bin/node
npm: 9.2.0 - /usr/bin/npm
Describe the bug
Some task are stuck indefinitely in waiting for no reasons. But it's random because it wont always be stuck
Reproduction repo
No idea
To reproduce
No idea on how to reproduce but maybe I am using something wrong, there's my code:
import { prisma } from "@dimension/core-lib/src/prisma"
import { Shop, ShopCookie } from "@dimension/database-main"
import { tiktokMessages } from "@dimension/tiktok-messages"
import { transformCookie } from "@dimension/tiktok-support-messages"
import { logger, schedules, task } from "@trigger.dev/sdk/v3"
import { handleError, handleMaxDuration, maxDurationPending } from "../lib/error"
import { getActiveShops, wrapCronJob } from "../lib/utils"
const isEnabled = true
const maxDurationWarning = 1000 * 60 * 20 // 20 minutes
const name = "Process shops messages campaigns"
const cron = "0 * * * *" // Every hour
export const processShopMessagesCampaigns = task({
id: "process-shop-messages-campaigns",
run: async ({ shop }: { shop: Shop & { cookie: ShopCookie | null } }) => {
/* Some DB operations */
})
export const processShopsMessagesCampaigns = schedules.task({
id: "process-shops-messages-campaigns",
cron: isEnabled ? cron : undefined,
run: async () => {
const now = new Date()
const main = async () => {
const shops = await getActiveShops(true)
if (!shops.length) {
logger.log("No shops found")
return
}
await processShopMessagesCampaigns.batchTriggerAndWait(
shops.map((shop) => ({
payload: { shop },
options: {
tags: [shop.slug],
},
}))
)
}
const checkDuration = maxDurationPending(name, maxDurationWarning)
await main()
},
})Additional information
No response
Metadata
Metadata
Assignees
Labels
No labels



Activity
rharkor commentedon Feb 6, 2025
This is the only problem I am encountering but it is very problematic since I made a policy of non overlapping crons this is blocking the whole process for the new crons
[-]bug:[/-][+]Self-hosted runs not completing[/+]matt-aitken commentedon Feb 13, 2025
This is a self-hosted deployment
murshudov commentedon Feb 13, 2025
For me worker container can't connect to coordinator using websocket, because of this run gets stuck. @rharkor could you please share your compose file?
murshudov commentedon Feb 13, 2025
rharkor commentedon Feb 13, 2025
rharkor commentedon Feb 13, 2025
I am using the app and worker separately, so I don't really know which one you want, also to mention that everything works fin 99.5% of the time.
murshudov commentedon Feb 13, 2025
I am running them on the same server, but would be great to see any working configuration. Pulling my hair for the last 3 days)
rharkor commentedon Feb 13, 2025
eth0izzle commentedon May 17, 2025
@murshudov did you manage to solve this? I'm also having the same issue.
murshudov commentedon May 17, 2025
@eth0izzle Yes, it is working for us quite well. I forgot all steps required, but can share updated compose file if needed
murshudov commentedon May 17, 2025
@eth0izzle Also our deployment is on Coolify
eth0izzle commentedon May 17, 2025
@murshudov yes also using coolify which I think where the issue is but I'm tearing my hair out. Your compose file would be much appreciated!
murshudov commentedon May 17, 2025
@eth0izzle I will try my best to explain.
docker-compose.ymlEnv vars for Coolify:
These are working files for us in production. It is a single server setup.
So issue was the following:
docker-providercreates worker containers for your tasks. But those containers get connected tohostnetwork by default and coordinator can't reach them, because coordinator is inside the network created by Coolify.By specifying
DOCKER_NETWORKon thedocker-providerwe create containers attached to the network created by Coolify so everyone can talk to anyone on this network.I may miss some details, but everything is created inside Coolify network by default, except the dynamically created worker containers. By this change introduced by @Mortalife these worker also get connected to Coolify network and everyone is happy.
Hope this helps.
[-]Self-hosted runs not completing[/-][+][v3] Self-hosted runs not completing[/+]nicktrn commentedon May 19, 2025
I'm going to close this as we're going to release v4 self-hosting in the next couple of weeks. Link to the excellent (unofficial) coolify self-hosting docs: https://github.com/Mortalife/trigger-dev-coolify