R
Railway2mo ago
Madster

CLI is not pushing seeders data on railway

I have two seeders to input data into my postgres server on railway. When I run the seeders, via CLI, It says they ran with no issues and the migrations finished, but there is no data within the required tables:
PS C:\Users\madis\source\incidents\backend> railway run npx sequelize-cli db:seed:all --seeders-path src/seeders --config src/config/config.js

Sequelize CLI [Node: 18.17.0, CLI: 6.6.2, ORM: 6.37.3]

Loaded configuration file "src\config\config.js".
Using environment "development".
== seed-global-roles: migrating =======
== seed-global-roles: migrated (0.017s)

== seed-permissions: migrating =======
== seed-permissions: migrated (0.002s)
PS C:\Users\madis\source\incidents\backend> railway run npx sequelize-cli db:seed:all --seeders-path src/seeders --config src/config/config.js

Sequelize CLI [Node: 18.17.0, CLI: 6.6.2, ORM: 6.37.3]

Loaded configuration file "src\config\config.js".
Using environment "development".
== seed-global-roles: migrating =======
== seed-global-roles: migrated (0.017s)

== seed-permissions: migrating =======
== seed-permissions: migrated (0.002s)
Solution:
Wasn't a script issue, I solved it. My config.ts for sequelize was set up in a way that if it fails connection, to default back to development NODE_ENV. It was failing because it was not recognizing postgres.railway.internal for the host....
Jump to solution
18 Replies
Percy
Percy2mo ago
Project ID: f3dbe28d-d8b5-4938-9809-d98b1e760b4b
Madster
MadsterOP2mo ago
f3dbe28d-d8b5-4938-9809-d98b1e760b4b Command I am running:
railway run npx sequelize-cli db:seed:all --seeders-path src/seeders --config src/config/config.js
railway run npx sequelize-cli db:seed:all --seeders-path src/seeders --config src/config/config.js
Brody
Brody2mo ago
how have you verified there isn't any data in the database?
Madster
MadsterOP2mo ago
Im on railway dashboard, the tables are empty
Brody
Brody2mo ago
the data tab will only show you tables in the default database, you might not be putting data into that database
Madster
MadsterOP2mo ago
What do you mean? When my backend service spins up, and is connected to the postgres instance I made, it creates all the required tables I need via sequelize I can log into pgAdmin4 to confirm, but im almost positive that the data isnt there, as a logged in user creating a tenant fails because on my backend, its trying to apply global roles to the user during tenant creation.
Brody
Brody2mo ago
please check with pgadmin
Madster
MadsterOP2mo ago
No description
Madster
MadsterOP2mo ago
No data within pgadmin either
Brody
Brody2mo ago
so if your data isn't making it into that database, where is it going?
Madster
MadsterOP2mo ago
Great question. I only have one database on railway. So why is it telling me that it succeeded in migration for seeders?
Brody
Brody2mo ago
that would be more of a question you have to ask yourself, we didn't write the seeder script haha
Madster
MadsterOP2mo ago
script works perfectly fine on local postgres server
Brody
Brody2mo ago
I would recommend you add better logging to the seeder script, if something is going wrong, why isn't it letting you know? unfortunately there isn't much we can do here as this isn't necessarily a platform issue
Madster
MadsterOP2mo ago
Is there a shell option on the dashboard?
Brody
Brody2mo ago
there is not, but this would be an issue with the script, if it isnt doing what its suppoed to it should be telling you whats wrong
Solution
Madster
Madster2mo ago
Wasn't a script issue, I solved it. My config.ts for sequelize was set up in a way that if it fails connection, to default back to development NODE_ENV. It was failing because it was not recognizing postgres.railway.internal for the host.
Brody
Brody2mo ago
ah, glad you solved that, partially a script issue, it should surface such errors.
Want results from more Discord servers?
Add your server