17 days ago
I have a cron service that runs daily. The Railway UI shows the service status as "Running" during execution and eventually completes, but no application logs appear in the Railway dashboard or via railway logs. The only line shown is:
Starting Container
No stdout or stderr output from my Node.js application is captured. Without logs, I can't tell if the application is actually running or silently failing. The same Docker image runs fine locally with full log output.
Service configuration (railway.toml):
[deploy]
startCommand = "Xvfb :99 -screen 0 1280x720x24 >/dev/null 2>&1 & export DISPLAY=:99 && echo 'Container started, launching sync...' && exec node
dist/scripts/fullSync.js"
cronSchedule = "5 13 * * *"
Runtime: Node.js on mcr.microsoft.com/playwright:v1.57.0-jammy (Dockerfile-based deployment)
What I've tried:
1. stdbuf --output=L — line-buffered stdout wrapper → no logs
2. process.stdout._handle.setBlocking(true) — force synchronous writes in Node → no logs
3. fs.writeSync(1, ...) — bypass Node's console.log entirely and write directly to fd 1 (stdout) and fd 2 (stderr) → still no logs
4. The echo in the start command itself (echo 'Container started, launching sync...') — also doesn't appear, only Railway's own "Starting Container" message shows the fact that even a plain shell echo before exec node doesn't appear suggests this isn't a Node buffering issue. Railway's log collector may not be capturing output from cron service executions.
Expected behavior: stdout/stderr from cron job runs should appear in the service logs, the same way they do for always-on services.
Questions:
- Is there a known limitation with log collection for cron-triggered services?
- Is there a different way to view logs for cron executions (e.g., a specific deployment/execution view)?
- Any recommended workarounds?
0 Replies