Whenever I run a deploy, I find that all data is lost.
I’m using the same type of database (postgres) in develop mode and production.
The cloud is AWS.
In develop mode, the database that is connected is a local PG. I don’t have access to the production database (AWS) locally.
I’m lost, what could I investigate?
Does anyone have any ideas that could help me?
env:
HOST=0.0.0.0
PORT=1337
APP_KEYS= X
API_TOKEN_SALT=X
ADMIN_JWT_SECRET=X
TRANSFER_TOKEN_SALT=X
# Database
DATABASE_CLIENT=postgres
DATABASE_HOST=localhost
DATABASE_PORT=5433
DATABASE_NAME=X
DATABASE_USERNAME=X
DATABASE_PASSWORD=X
DATABASE_SSL=false
JWT_SECRET=X
Env production:
APP_KEYS= '' // you can find it in your project .env file.
API_TOKEN_SALT= ''
ADMIN_JWT_SECRET= ''
JWT_SECRET= ''
NODE_ENV= 'production'
DATABASE_HOST= '' // database Endpoint under 'Connectivity & Security' tab
DATABASE_PORT= ''
DATABASE_NAME= 'X' // DB name under 'Configuration' tab
DATABASE_USERNAME= '' // default username
DATABASE_PASSWORD= ''
AWS_ACCESS_KEY_ID= ''
AWS_ACCESS_SECRET= '' // Find it in Amazon S3 Dashboard
AWS_REGION= 'sa-east-1'
AWS_BUCKET_NAME= 'X'
I assume your database is hosted in AWS RDS and not a database running from the same service (EC2, ECS) where the application is running?
Also, do you lose content, and users from the database? Is it like a fresh Strapi installation?
Thanks for helping me! 
I identified the problem.
In the production env, the parameter was missing:
DATABASE_CLIENT= 'postgres'
With that, a sqlite database was being created in production.
As always, the error is silly!
1 Like
You’re not the first to make this mistake and I was going to assume this in my previous answer.
I think Strapi should be explicitly expecting this value to be provided. It shouldn’t assume it’s SQLite.
Glad you sorted it out.