please I had previously deployed my Django project on Railway which worked fine. Unfortunately, when I tried to add up SendGrid mail functionality by using django-sendgrid-v5
package to help me handle that, everything worked pretty well in the development environment including SendGrid mails like Signup user.
However, when I deployed it on Railway which uses Nixpacks to manage its default project build, I kept getting this weird error that ENV cannot be blank. I followed their deployment procedures on Python since they have a similar deployment infrastructure to Heroku. I made sure that all the (env) variables needed to run the project in their platform were set correctly. I had checked my settings.py
files and my .env
files to know whether I was missing anything there, but I could not find the error. I even uninstall the django-sendgrid-v5
which I believed could have introduced the error, still my deployment kept on crashing.
Below is the deployment build code which has been persistent.
`
╔══════════════════════════════ Nixpacks v1.16.0 ══════════════════════════════╗
║ setup │ python310, postgresql, gcc ║
║──────────────────────────────────────────────────────────────────────────────║
║ install │ python -m venv --copies /opt/venv && . /opt/venv/bin/activate ║
║ │ && pip install -r requirements.txt ║
║──────────────────────────────────────────────────────────────────────────────║
║ start │ python manage.py migrate && gunicorn kester_autos.wsgi ║
╚══════════════════════════════════════════════════════════════════════════════╝
#0 building with "default" instance using docker driver
#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 2.06kB done
#1 DONE 0.0s
#2 [internal] load .dockerignore
#2 transferring context: 2B done
#2 DONE 0.0s
Dockerfile:12
10 |
11 | ARG DATABASE_URL EMAIL_BACKEND EMAIL_HOST EMAIL_HOST_PASSWORD EMAIL_HOST_USER NIXPACKS_METADATA PYTHONUNBUFFERED RAILWAY_ENVIRONMENT RAILWAY_ENVIRONMENT_ID RAILWAY_ENVIRONMENT_NAME RAILWAY_GIT_AUTHOR RAILWAY_GIT_BRANCH RAILWAY_GIT_COMMIT_MESSAGE RAILWAY_GIT_COMMIT_SHA RAILWAY_GIT_REPO_NAME RAILWAY_GIT_REPO_OWNER RAILWAY_PROJECT_ID RAILWAY_PROJECT_NAME RAILWAY_SERVICE_ID RAILWAY_SERVICE_NAME SECRET_KEY
12 | >>> ENV =$ DATABASE_URL=$DATABASE_URL EMAIL_BACKEND=$EMAIL_BACKEND EMAIL_HOST=$EMAIL_HOST EMAIL_HOST_PASSWORD=$EMAIL_HOST_PASSWORD EMAIL_HOST_USER=$EMAIL_HOST_USER NIXPACKS_METADATA=$NIXPACKS_METADATA PYTHONUNBUFFERED=$PYTHONUNBUFFERED RAILWAY_ENVIRONMENT=$RAILWAY_ENVIRONMENT RAILWAY_ENVIRONMENT_ID=$RAILWAY_ENVIRONMENT_ID RAILWAY_ENVIRONMENT_NAME=$RAILWAY_ENVIRONMENT_NAME RAILWAY_GIT_AUTHOR=$RAILWAY_GIT_AUTHOR RAILWAY_GIT_BRANCH=$RAILWAY_GIT_BRANCH RAILWAY_GIT_COMMIT_MESSAGE=$RAILWAY_GIT_COMMIT_MESSAGE RAILWAY_GIT_COMMIT_SHA=$RAILWAY_GIT_COMMIT_SHA RAILWAY_GIT_REPO_NAME=$RAILWAY_GIT_REPO_NAME RAILWAY_GIT_REPO_OWNER=$RAILWAY_GIT_REPO_OWNER RAILWAY_PROJECT_ID=$RAILWAY_PROJECT_ID RAILWAY_PROJECT_NAME=$RAILWAY_PROJECT_NAME RAILWAY_SERVICE_ID=$RAILWAY_SERVICE_ID RAILWAY_SERVICE_NAME=$RAILWAY_SERVICE_NAME SECRET_KEY=$SECRET_KEY
13 |
14 | # setup phase
ERROR: failed to solve: dockerfile parse error on line 12: ENV names can not be blank
Error: Docker build failed`
I had looked up the possible solutions but to no avail. How to remove that blank ENV is what I don't know how to do or sort out since they built the project automatically.
Please, your help and sorting this issue out would be really appreciated. Thank you.
You have added an empty env variable on railway:
ENV =$ <<--- here's it
check the "Variables" tab on Railway you might have something like: