D
Dokploy7mo ago
thes4s

Github deploy /w Nixpack env not showing

I have a nodejs project that I have setup with Dokploy via GH to deploy. At runtime it crashes because of missing env vars. When I do printenv in the terminal, I don't see my variables that I have set it in the Environment UI tab. I dont have a docker-compse.yml in my repo. What am I doing wrong?
12 Replies
Siumauricio
Siumauricio7mo ago
what application you trying to deploy?
thes4s
thes4sOP7mo ago
An express server
Siumauricio
Siumauricio7mo ago
are you using github and nixpacks?
thes4s
thes4sOP7mo ago
Yep
Siumauricio
Siumauricio7mo ago
can you share how are you reading the envs in your express app
thes4s
thes4sOP7mo ago
something like: process.env.SECRET_KEY
Siumauricio
Siumauricio7mo ago
Yeah but I mean are you using dotenv or some library to read?
thes4s
thes4sOP7mo ago
Yeah, on some files I do this: import { config } from 'dotenv'; config(); Some I dont, do I need to do it on all then?
Siumauricio
Siumauricio7mo ago
can you share your package json? well I think you need to do only in the entrypoint file like main.ts
thes4s
thes4sOP7mo ago
{ "name": "server", "version": "1.0.0", "description": "", "main": "main.ts", "type": "module", "scripts": { "start": "tsx main.ts | npx pino-pretty", "test": "vitest --config vitest.config.ts", "test:watch": "jest --watch --detectOpenHandles", "dev": "nodemon --exec tsx main.ts | npx pino-pretty" }, "keywords": [], "author": "", "license": "ISC", "dependencies": { "@adminjs/express": "^6.1.0", "@adminjs/prisma": "^5.0.3", "@aws-sdk/client-s3": "^3.550.0", "@aws-sdk/lib-storage": "^3.550.0", "@aws-sdk/s3-request-presigner": "^3.550.0", "@bull-board/api": "^5.15.2", "@bull-board/express": "^5.15.2", "@faker-js/faker": "^8.4.1", "@slate-serializers/html": "^2.2.1", "@types/compression": "^1.7.5", "@types/cookie-parser": "^1.4.7", "@types/cors": "^2.8.17", "@types/json-bigint": "^1.0.4", "@types/mime-types": "^2.1.4", "@types/nodemailer": "^6.4.15", "7zip-bin": "^5.2.0", "adminjs": "^7.8.7", "bcrypt": "^5.1.1", "bullmq": "^5.4.6", "compression": "^1.7.4", "cookie-parser": "^1.4.6", "cors": "^2.8.5", "discord.js": "^14.15.2", "dotenv": "^16.4.5", "express": "^4.18.3", "express-formidable": "^1.2.0", "express-rate-limit": "^7.3.1", "express-session": "^1.18.0", "handlebars": "^4.7.8", "helmet": "^7.1.0", "json-bigint": "^1.0.0", "jsonwebtoken": "^9.0.2", "mime-types": "^2.1.35", "moment": "^2.30.1", "moment-timezone": "^0.5.45", "multer": "^1.4.5-lts.1", "nanoid": "^5.0.6", "node-7z": "^3.0.0", "nodemailer": "^6.9.14", "nodemon": "^3.1.0", "passport": "^0.7.0", "passport-google-oauth20": "^2.0.0", "pg": "^8.11.3", "pg-hstore": "^2.3.4", "pino": "^9.4.0", "pino-http": "^10.3.0", "rate-limit-redis": "^4.2.0", "redis": "^4.6.15", "square": "^37.0.0", "tslib": "^2.6.3", "twilio": "^5.0.4" },
Siumauricio
Siumauricio7mo ago
try to set this tsx -r dotenv/config main.ts && ..... in the start command
thes4s
thes4sOP7mo ago
Alright thanks, will try that now. @Siumauricio that worked tysm

Did you find this page helpful?