R
Railway•2w ago
Raz | Ooga

Cron job deployment logs not showing up

Project id: 8eeaf105-a438-44c0-9215-78f268bcf4a9. I am trunning to run a cron job that has the configuration set in a railway.toml file I have configured it so that it run from a docker file. If I build the image and run it locally everything works as expected. Yet, when I deploy it on Railway, the cron services shows that it is about to run in x minutes but, aside from successfully building the Docker image, there are no deploy logs. How I translate that is that the container is not run in the first place.
42 Replies
Percy
Percy•2w ago
Project ID: 8eeaf105-a438-44c0-9215-78f268bcf4a9
Raz | Ooga
Raz | Ooga•2w ago
Hello @Brody ! Do you reckon there might be something that I might've misconfigured? If it's the case for a bug is there a workaround for it?
Brody
Brody•2w ago
please do not tag team or mods - #🛂|readme #5 anyway, what makes you say the container isn't being ran?
Raz | Ooga
Raz | Ooga•2w ago
Thank you for your response. The fact that it is not displaying anything in the Deploy logs section. yet, it should since it thoretcally "has been run"
SCIENTIFIC
SCIENTIFIC•2w ago
+1 – I am seeing the same. I waited up to an hour in the event there was some queue delay. I see several posts that seem to suggest crons have stopped working or there is a behavior change: https://help.railway.app/feedback/cron-reliability-improvements-c2f2c959
Railway Help Station
Cron Reliability Improvements
Hello,We've been barreling towards reliability improvements recently. In fact, it's our focus for the next 3 months.Crons, historically have been "Alright but not bulletproof". Sometimes they'd skip, sometimes they'd get stuck, etc. Not a great experience at all.We've rolled out a couple changes this week that should abate thisPlease let us know...
Brody
Brody•2w ago
im not seeing any cron services in any of your environments?
Raz | Ooga
Raz | Ooga•2w ago
Um, I think there should be. development-testnet environment Cron Jobs group. I think service id of one of the cron jobs is: 17c81b48-6409-4b66-ba85-5537f35e62aa
Raz | Ooga
Raz | Ooga•2w ago
No description
Raz | Ooga
Raz | Ooga•2w ago
No description
Raz | Ooga
Raz | Ooga•2w ago
builder = "DOCKERFILE"
dockerfilePath = "./cron/<hidden-path>/Dockerfile"
watchPatterns = ["cron/**", "packages/**", "!/*.md", "package.json"]

[deploy]
cronSchedule = "0 0 * * *"
region = "europe-west4"
builder = "DOCKERFILE"
dockerfilePath = "./cron/<hidden-path>/Dockerfile"
watchPatterns = ["cron/**", "packages/**", "!/*.md", "package.json"]

[deploy]
cronSchedule = "0 0 * * *"
region = "europe-west4"
Brody
Brody•2w ago
I must be blind then, my bad, I'll give another look
Raz | Ooga
Raz | Ooga•2w ago
Please, it would be really helpful. Maybe there is something misconfigured on our end
Brody
Brody•2w ago
I'll look when I'm back at my computer :salute: but in the mean time, please tell me more about this cron job. language? what does it achieve? are you using a logger library? etc update, found the service, something really strange is going on here for sure
Raz | Ooga
Raz | Ooga•2w ago
Great news. The service is trying to run a Dockerfile that runs a binary file created after bun env build action. Other than that it is pretty standard. Locally (on my machine Macbook M1 series) everything works fine. For some reason on the Railway env nothing works Language is Typescript Run time environment is bun.js logger is used everywhere in our project so I doubt it's the case, we use pino The railway.toml is provided above. Here is the Dockerfile:
# oven/bun images dont work, have to have node underneath to build
FROM node:20.12.2 AS build

RUN npm install -g bun@1.1.26
WORKDIR /app
COPY . .
RUN bun install --frozen-lockfile --prefer-offline

ARG TURBO_TEAM
ENV TURBO_TEAM=$TURBO_TEAM
ARG TURBO_TOKEN
ENV TURBO_TOKEN=$TURBO_TOKEN
RUN bun turbo build --filter secret-cron-name

FROM gcr.io/distroless/base-debian11
WORKDIR /app
COPY --from=build /app/cron/secret-cron-name/bin /app/bin

CMD [ "/app/bin" ]
# oven/bun images dont work, have to have node underneath to build
FROM node:20.12.2 AS build

RUN npm install -g bun@1.1.26
WORKDIR /app
COPY . .
RUN bun install --frozen-lockfile --prefer-offline

ARG TURBO_TEAM
ENV TURBO_TEAM=$TURBO_TEAM
ARG TURBO_TOKEN
ENV TURBO_TOKEN=$TURBO_TOKEN
RUN bun turbo build --filter secret-cron-name

FROM gcr.io/distroless/base-debian11
WORKDIR /app
COPY --from=build /app/cron/secret-cron-name/bin /app/bin

CMD [ "/app/bin" ]
Brody
Brody•2w ago
what are your logging settings? are you logging unbuffered to stdout / stderr?
Want results from more Discord servers?
Add your server