R
Railwayβ€’12mo ago
manubier

NPM build script started to fail

I am running migrations during the build and have the following script in my package.json for this: "migrate:deploy": "DATABASE_URL="$MIGRATE_DATABASE_URL" prisma migrate deploy", It seems like the script doesn't have access to the ENV variables anymore even though there were no changes.
32 Replies
Percy
Percyβ€’12mo ago
Project ID: a32aec5d-84a3-4341-ac97-84f750c61df3
manubier
manubierβ€’12mo ago
a32aec5d-84a3-4341-ac97-84f750c61df3
Brody
Brodyβ€’12mo ago
what is MIGRATE_DATABASE_URL set to?
manubier
manubierβ€’12mo ago
the postgres connection url
Brody
Brodyβ€’12mo ago
public or private url?
manubier
manubierβ€’12mo ago
postgres[ql]://[username[:password]@][host[:port],]/database
Brody
Brodyβ€’12mo ago
^
manubier
manubierβ€’12mo ago
Ran a test via this script: "testenv": "echo export $MIGRATE_DATABASE_URL", actually this: "testenv": "echo Migrate Database URL: $MIGRATE_DATABASE_URL && echo Database URL: $DATABASE_URL" } and don't seem to have access
Brody
Brodyβ€’12mo ago
^
manubier
manubierβ€’12mo ago
Are you asking me to share my access credentials to the db?
Brody
Brodyβ€’12mo ago
not at all
manubier
manubierβ€’12mo ago
Then I don't get your "public or private url"
Brody
Brodyβ€’12mo ago
are you using a public or private database url
manubier
manubierβ€’12mo ago
sorry needed to check on that. I am using the public url
Brody
Brodyβ€’12mo ago
how are you getting railway to run your migrate:deploy script
manubier
manubierβ€’12mo ago
via my package.json (which has worked fine so far until recently): "build": "npm run testenv && npm run migrate:deploy", "migrate:deploy": "DATABASE_URL="$MIGRATE_DATABASE_URL" prisma migrate deploy" The container which is currently still up and running resolved to node 21.1.0 The failing container is resolving to 20.9.0 I wonder if it's somehow related to the project using Heroku-20 buildpack which based on the UI is now deprecated in railway
Brody
Brodyβ€’12mo ago
oh wow, didnt think id ever run into anyone who is still using heroku's buildpack
manubier
manubierβ€’12mo ago
hahaha, haven't really touched this app for a long time πŸ˜„
Brody
Brodyβ€’12mo ago
try to get it running on nixpacks?
manubier
manubierβ€’12mo ago
is there a migration guide?
Brody
Brodyβ€’12mo ago
unfortunately no
manubier
manubierβ€’12mo ago
Is there anything where I can find a proper walkthrough how I would create a nodejs project that runs migrations during buid process?
Brody
Brodyβ€’12mo ago
dont know why you have the DATABASE_URL="$MIGRATE_DATABASE_URL" otherwise i dont see anything wrong with how youre doing it
manubier
manubierβ€’12mo ago
Do I just have to add a nixpacks.toml and then railway picks it up from there or do I have to also change some settings?
Brody
Brodyβ€’12mo ago
im going to chalk this up to using a build pack that was deprecated like over 3 years ago i honestly dont know how to switch but @jr would know
jr
jrβ€’11mo ago
Hey @manubier, wow I am surprised to find this project using the buildpacks. They are very much depreceated and should not be used. I can switch your app over to nixpacks if you would like
manubier
manubierβ€’11mo ago
That would be awesome! The overall prject is actually split up into 3 railway projects and all are still using the old buildpack. Should I just post the ids also here?
jr
jrβ€’11mo ago
yup please do I've updated one already
manubier
manubierβ€’11mo ago
4c5a05a8-8ff6-40cd-b506-3c5d7efa5654 2bd6ba91-fc04-479a-bcce-fbe0d3638596 Do I still have to do something for build scripts I used before or should this be working now?
jr
jrβ€’11mo ago
You will just need to redeploy
manubier
manubierβ€’11mo ago
nice, seems to work. Thank you!
jr
jrβ€’11mo ago
glad I could help πŸ˜„
Want results from more Discord servers?
Add your server