R
Railwayβ€’13mo 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β€’13mo ago
Project ID: a32aec5d-84a3-4341-ac97-84f750c61df3
manubier
manubierOPβ€’13mo ago
a32aec5d-84a3-4341-ac97-84f750c61df3
Brody
Brodyβ€’13mo ago
what is MIGRATE_DATABASE_URL set to?
manubier
manubierOPβ€’13mo ago
the postgres connection url
Brody
Brodyβ€’13mo ago
public or private url?
manubier
manubierOPβ€’13mo ago
postgres[ql]://[username[:password]@][host[:port],]/database
Brody
Brodyβ€’13mo ago
^
manubier
manubierOPβ€’13mo 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β€’13mo ago
^
manubier
manubierOPβ€’13mo ago
Are you asking me to share my access credentials to the db?
Brody
Brodyβ€’13mo ago
not at all
manubier
manubierOPβ€’13mo ago
Then I don't get your "public or private url"
Brody
Brodyβ€’13mo ago
are you using a public or private database url
manubier
manubierOPβ€’13mo ago
sorry needed to check on that. I am using the public url
Brody
Brodyβ€’13mo ago
how are you getting railway to run your migrate:deploy script
manubier
manubierOPβ€’13mo 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β€’13mo ago
oh wow, didnt think id ever run into anyone who is still using heroku's buildpack
manubier
manubierOPβ€’13mo ago
hahaha, haven't really touched this app for a long time πŸ˜„
Brody
Brodyβ€’13mo ago
try to get it running on nixpacks?
manubier
manubierOPβ€’13mo ago
is there a migration guide?
Brody
Brodyβ€’13mo ago
unfortunately no
manubier
manubierOPβ€’13mo 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β€’13mo ago
dont know why you have the DATABASE_URL="$MIGRATE_DATABASE_URL" otherwise i dont see anything wrong with how youre doing it
manubier
manubierOPβ€’13mo 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β€’13mo 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β€’13mo 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
manubierOPβ€’13mo 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β€’13mo ago
yup please do I've updated one already
manubier
manubierOPβ€’13mo 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β€’13mo ago
You will just need to redeploy
manubier
manubierOPβ€’13mo ago
nice, seems to work. Thank you!
jr
jrβ€’13mo ago
glad I could help πŸ˜„
Want results from more Discord servers?
Add your server