You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
npx sequelize-cli db:migrate command don't read the environment variables
This command works without problems in my local environment on macOS Sonoma 14.2.1 but when I try to run it in a development environment (PM2 version 5.3.1) it does not work
Get a message similar to the one obtained in my local macOS environment
> js-backend@0.0.0 migrations:run
> sequelize-cli db:migrate
Sequelize CLI [Node: 20.11.0, CLI: 6.6.2, ORM: 6.37.3]
Loaded configuration file "src/db/config/config.cjs".
Using environment "development".
Executing (default): SELECT 1+1 AS result
Executing (default): CREATE SCHEMA IF NOT EXISTS "vic";
Executing (default): SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' AND table_type LIKE '%TABLE' AND table_name != 'spatial_ref_sys';
Executing (default): SELECT pk.constraint_type as "Constraint",c.column_name as "Field", c.column_default as "Default",c.is_nullable as "Null", (CASE WHEN c.udt_name = 'hstore' THEN c.udt_name ELSE c.data_type END) || (CASE WHEN c.character_maximum_length IS NOT NULL THEN '(' || c.character_maximum_length || ')' ELSE '' END) as "Type", (SELECT array_agg(e.enumlabel) FROM pg_catalog.pg_type t JOIN pg_catalog.pg_enum e ON t.oid=e.enumtypid WHERE t.typname=c.udt_name) AS "special", (SELECT pgd.description FROM pg_catalog.pg_statio_all_tables AS st INNER JOIN pg_catalog.pg_description pgd on (pgd.objoid=st.relid) WHERE c.ordinal_position=pgd.objsubid AND c.table_name=st.relname) AS "Comment" FROM information_schema.columns c LEFT JOIN (SELECT tc.table_schema, tc.table_name, cu.column_name, tc.constraint_type FROM information_schema.TABLE_CONSTRAINTS tc JOIN information_schema.KEY_COLUMN_USAGE cu ON tc.table_schema=cu.table_schema and tc.table_name=cu.table_name and tc.constraint_name=cu.constraint_name and tc.constraint_type='PRIMARY KEY') pk ON pk.table_schema=c.table_schema AND pk.table_name=c.table_name AND pk.column_name=c.column_name WHERE c.table_name = 'SequelizeMeta' AND c.table_schema = 'public'
Executing (default): SELECT table_name FROM information_schema.tables WHERE table_schema = 'vic' AND table_name = 'SequelizeMeta'
Executing (default): SELECT i.relname AS name, ix.indisprimary AS primary, ix.indisunique AS unique, ix.indkey AS indkey, array_agg(a.attnum) as column_indexes, array_agg(a.attname) AS column_names, pg_get_indexdef(ix.indexrelid) AS definition FROM pg_class t, pg_class i, pg_index ix, pg_attribute a, pg_namespace s WHERE t.oid = ix.indrelid AND i.oid = ix.indexrelid AND a.attrelid = t.oid AND t.relkind = 'r' and t.relname = 'SequelizeMeta' AND s.oid = t.relnamespace AND s.nspname = 'vic' GROUP BY i.relname, ix.indexrelid, ix.indisprimary, ix.indisunique, ix.indkey ORDER BY i.relname;
Executing (default): SELECT "name" FROM "vic"."SequelizeMeta" AS "SequelizeMeta" ORDER BY "SequelizeMeta"."name" ASC;
What is actually happening?
I am getting this message in the terminal, where it is not reading the environment variables and is not creating the models in the database
@aobregonmx I try to run sequelize-cli command in the ec2 instance with inline environment variables but it doesn't work. To resolve the issue i need to set env globally for the current shell session using the command export <ENV_NAME>=<ENV_VALUE> <COMMAND_TO_RUN>
Is the sequelize-cli not able to use an inline environment variable.
I think sequelize-cli runs outside of the PM2 environment and that's why it doesn't read the injected variables. When I have implemented CI it will carry out the process of creating the .env file as indicated in the comments of the official documentation Environment Variables Management
What you are doing?
npx sequelize-cli db:migrate
command don't read the environment variablesThis command works without problems in my local environment on macOS Sonoma 14.2.1 but when I try to run it in a development environment (PM2 version 5.3.1) it does not work
.sequelizerc
config.cjs
common/config.js
What do you expect to happen?
Get a message similar to the one obtained in my local macOS environment
What is actually happening?
I am getting this message in the terminal, where it is not reading the environment variables and is not creating the models in the database
I tried printing the variables and either way I'm getting undefined
Dialect: postgres
Database version: PostgreSQL 12.19 (Ubuntu 12.19-0ubuntu0.20.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.3) 9.4.0, 64-bit
Sequelize CLI version: 6.6.2
Sequelize version: 6.37.3
PM2 version: 5.3.1
The text was updated successfully, but these errors were encountered: