When to run Database Migrations and Seed?
I am creating a template but the template always fails because the RAILWAY_STATIC_URL is undefined which breaks next.js and it always fails during the database seed
This is a GitHub gist of the errors
https://gist.github.com/dephraiim/b82fe06248d72496f2297e693504d7d7
19 Replies
Project ID:
235891b1-c0ef-4dda-b8e8-ee34548ea614
235891b1-c0ef-4dda-b8e8-ee34548ea614
these errors are from the build stage, correct? and are you using a dockerfile?
They’re from the build stage. I’m not using a custom docker file
interesting, I will do some testing and get back to you
The build was working before and I had a DATABASE_URL error I reported earlier and when that was fixed, I got this error
can I see a screenshot of your service variables
i can reproduce this bug, those variables would just turn into
https://
after the template is deployed, this is solved by deleting and re-adding them after the service has deployed, but i will flag the team on this issueFlagging this thread. A team member will be with you shortly.
If I understand correctly, the
RAILWAY_STATIC_URL
not being available during the build phase is the issue?
Did you try deploying a second time and seeing if it was available during the build?
I wonder if it simply doesn't exist during the first build as the URL hasn't been created yet.it renders to
https://
during build and while the app runs, same across rebuilds, remove the variable, cancel the redeploy, and then add it back and let the redeploy happen is what fixed it for me
I am using that same variable in the exact same way they are in my chatwoot template, once deployed any links provided by chatwoot would end up being broken because it thought the domain was https
Do you have a template where this happens? I am unable to reproduce it
ill try to set something up
i created this template in hopes of reproducing it https://railway.app/template/eagBhc
but it worked fine, the template variable rendered just fine
i'll look into this
@Brody I recreated the same template with the exact variables and it works this time.
I think the issue is from my end, I didn't check the Attach Domain checkbox when I was creating template.
I checked it on the second template and I had no issue
well that's good that it's no longer a problem! solved then
Thank you. I couldn’t find any documentation on the Attach Domain checkbox, maybe it could be added in the future?
Wanna PR it here? https://docs.railway.app/reference/templates#creating-a-template
Sure, I'll do that