2 years ago
The strapi app deployed successfully, crashes after 5 seconds and the restarts. I have added all the necessary Postgres Variables and update config/database.ts still it doesn’t work.
66 Replies
2 years ago
Are you using the template?
2 years ago
this one https://railway.com/template/strapi
I deployed my project on railway and deployed a new Postgres for the project
2 years ago
Please check the DB credentials
2 years ago
Check if strapi is using the correct ones
In database.ts: there are configs like PGHOST, PGDATABASE etc but environment variables are DATABASE_HOST, DATABASE_NAME. Which is the right one to use
2 years ago
just updated it to use latest, do you want to give that a go?
2 years ago
https://railway.com/template/strapi all instructions r here
2 years ago
Yeah, because locally ur postgres instance has other creds, ur trying to log in with "root" while the default user on the railway postgres db is "postgres"
2 years ago
Anyway, did u manage to deploy it through the template @frankiefab ?
Using this template requires me create new content types and documents on strapi
I can’t tell why the developer relations team at Railway suggest this same template for every problem. There should a better solution
2 years ago
hello, these people are community members and moderators, them recommending something that is known working is a good recommendation.
2 years ago
either way, the project you linked has been deleted
2 years ago
would you like to provide a new project id for me to look into?
2 years ago
alright fixed it up for you, you can look at your activity logs to see what i needed to do to fix your project up
Thank you. But any reason why the strapi content still doesn’t show up on the frontend even after successful deployment.
2 years ago
link to frontend please?
Seems I will need to update config/database.ts to match the Postgres env. variables
https://frankiefab.vercel.app/projects
Here is the page where the strapi content should display.
I already create config/env/production/database.ts:
module.exports = ({ env }) => ({
connection: {
client: 'postgres',
connection: {
host: env('PGHOST', '127.0.0.1'),
port: env.int('PGPORT', 5931),
database: env('PGDATABASE', 'railway'),
user: env('PGUSER', 'postgres'),
password: env('PGPASSWORD', 'password'),
ssl: env.bool(true),
},
},
});2 years ago
nope, i aleady set the needed variables, please look at the changes i made in your activity tab
2 years ago
this page is not makeing an api request to strapi to begin with
When the STRAPI_URL is already updated in the client side fetch request
2 years ago
have you logged into your strapi /admin pannel and made sure the needed data is there?
2 years ago
i'm sorry but i can't help with deleted data
I just run strapi locally via localhost:1337/admin. I see the contents.
2 years ago
when you develop locally, are you connecting to the postgres database on railway?
2 years ago
then of course there isnt going to be any data when you deploy to railway
This too. After updating config/database.ts to connect to Postgres on railway

2 years ago
you need to use the public host and port when connecting to the database locally
2 years ago
Neither of those are the public host or port, you can find the public host and port of your database under its public networking section
This. But on railway the Postgres port is 5432 and Public host points to DATABASE_PUBLIC_URL which is different too. Sorry, this can be confusing. Do I need to update the Postgres variables again since the Strapi variables references it.

2 years ago
that is the public domain of your app, please look at the public networking section of the database, and please do not modify any variables on railway again as I have set them how they need to be
2 years ago
you need to use the TCP proxy
2 years ago
yes
2 years ago
postgres does not use WebSockets
2 years ago
connect to the database with viaduct.proxy.rlwy.net:17157
2 years ago
it does, the data tab can connect to it, and the data tab uses that host and port
2 years ago
when you develop locally you need to have strapi connect to the database on railway
Any helpful resources. What needs to be updated in config/database or config/server
2 years ago
this is why the community has recommended you the template -
please read its overview and look at how its setup -
2 years ago
going to mark this as solved now that you have all the resources you need to succeed now!
2 years ago
!s
Status changed to Solved brody • over 1 year ago


