Start Command Not Working
Service ID: af744a5e-c6be-4615-b596-ecda25dd13ea
Configuration: See below & attached screenshot
Build is succeeding, but for some reason, I see the following errors in the Deploy Logs:
Can I get some help on this? Thank you 🙏🙏🙏
114 Replies
Project ID:
af744a5e-c6be-4615-b596-ecda25dd13ea
Since it looks like pnpm is not an available command, in reviewing the nixpacks documentation I believe you need to add a
nixpacks.toml
to your project repo, and within that include:
Ah, makes sense. I'll try that out and let you know if that resolves my issue. Thank you!
you can also specify
nixPkgs
in the railway.json file, this way you won't need two config filesOh nice, I'll keep note of that for myself
I have a monorepo set up with different configuration needs for each project. How would I create a
railway.json
to account for this?each directoy would need its own railway.json file with the appropriate configurations for that specific app, then just deployed two services and set the root directory appropriately, then railway will use the railway.json in that directory
is this a JavaScript frontend with a Go backend?
Yes, it is. The reason why I originally asked how to account for separate configurations is because I need scripts in the root
package.json
to run as codegen the API client library from a codegened swagger.json
in the Go project. But I think it shouldn't be an issue to set the root directory to the ui
directory as PNPM will still run the proper scripts from the root package.json
, even within a workspace directory. I'll try it out and get back you. Thank @Brody!can you share your repo so I can get a better idea of what's going on?
It's a private repo. Is it possible to add you as a collaborator?
for sure
brody192
Invite sent!
that's a very peculiar repo you have there
lol, yes, it's a dApp we're building for a hackathon, so there's a lot of interesting things happening in there 😅
as a go dev, I've never seen someone mix node and go in such a way
Yeah, it took me a couple days to figure out how to get everything to play nicely together 🫠, but it's a nice DX since I codegen the API & smart contract clients so I don't have to think about typing in the front end 🥹🥹🥹
I'm still struggling to figure out the
railway.json
file though. Do you mind providing some guidance? Looking at https://backboard.railway.app/railway.schema.json but it's a bit hard to grok since I'm not well versed with JSON schema definitions
Does this look right?
do you use vscode?
Yes, I do!
is it telling you that that file is valid?
Looks like it is
use a
setup
phase instead
also remove the 3 dots from the providers arraySo like this?
looks good to me
Cool! Let me push and see if it works
but I've never done a turbo/mono repo, or mixed node and go
so I'm not too sure
Also, it looks like you can specify the location of the Railway configuration file:
indeed
I haven't either, this is my first time doing this haha
just feel the need to say this..
setting the root directory to
/ui
and the railway config path to /ui/railway.json
would be redundantYeah, I have the root directory set to
/
and the configuration path as /ui/railway.json
that doesn't seem correct
Oh, why do you say that?
just seems wrong lol
Also, I'm getting these build errors
pnpm isnt even a nix package, bro just made it up and we trusted him
thats kinda funny tbh
railway will install pnpm for you if it detects a pnpm-lock.yaml, so make that happen, then you can remove the pnpm stuff from your railway.json file
LOL, @gridonyx, you did me dirty 😭
anyway, i how to go mow the lawn before it rains, ill be back later
i wish you good luck!
All good, found useful documentation here: https://nixpacks.com/docs/providers/node
Node | Nixpacks
App source + Nix packages + Docker = Image
I'll play around with it. Thanks @Brody!
i was just looking at the source code lol
https://github.com/railwayapp/nixpacks/blob/main/src/providers/node/mod.rs#L334
Oof, good on you sir, this would give me a headache to read 🙀
I was just going based off the nixpacks docs lmao, the only other thing in the docs is to use aptPkgs instead of nixPkgs
Apologies for any confusion
All good! You don't need to configure anything for PNPM, per @Brody's message (https://discord.com/channels/713503345364697088/1121523128649142282/1121536675802271816), Nixpack automatically detects it
Discord
Discord - A New Way to Chat with Friends & Communities
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
any luck?
Having trouble with the build command...I can't even run
node
🫠how many total services are in this repo
2
and what folders are they located in
ui
& api
for the front end and back end respectivelywhats contracts for
Those are smart contracts that'll be deployed to Fuji Testnet on Avalanche
okay not applicable here
Yeah, it's not relevant
I got the UI running before is the weird part with the following config:
NOTE:
ui
used to be called app
But bc I needed Go in the build step, I added providers and that's when the deployment stopped workingi keep getting
ERR_PNPM_FETCH_404 GET https://registry.npmjs.org/@avalabs/k2-components/-/k2-components-4.10.0-alpha.9.tgz: Not Found
Yes, bc that's a private package internal to our company 🥲
well that makes it hard for me to test lol
Yeah 😅
Let me create a minimal reproducible set up
do you need to do anything with the go app before starting the ui app
that would be awsome
I could also set up a VSCode live share and give you access to my terminal
Which would be quicker
id kinda need access to railway too, so minimal repo would be best
?
kk, I'll create a minimal repo
Give me a second!
pls answer question lol
Ah, sorry, the Go app doesn't need to run to start the UI app, I just need to run a codegen to create a
swagger.json
file which I need to codegen the API client for the UI
But running the codegen to create a swagger.json
requires a Go environment as I'm using go-swagger
to do ityou sure have massively over complicated this
Yes I did 🥲
https://github.com/iknowhtml/trustus-monorepo/tree/railway-minimal-repo
Does this work?
Do you want me to set up a separate Railway environment?
so starting from the root directory, give me a list of commands id have to run to generate the swagger.json file, and start the ui (assuming i have npm, pnpm, go, node all installed already)
If this were a docker container, that's all you would need to do
well it is a docker container lol
i dont see how those commands generate a swagger.json file?
pnpm i
runs preinstall
& postinstall
what triggers those to run
Running
pnpm i
It's NPM non-sense lolah cool
i will run those exact commands loaclly
Yes, let me know if you run into any issues
You're not running Windows by chance are you? This set up assumes a unix-like environment
yes i am
idealy you set your app up so it can run whereever
Ideally, but I didn't 🫠
didnt do a lot of things lol
You're not running into any issue using Windows tho are you?
downloading is slow as hell
who ever said pnpm was faster
It's fast on fully maxed out Macbook Pro 🤣
'sh' is not recognized as an internal or external command,
│ operable program or batch file.
makes sense
i can convertSounds good! Appreciate it 🙂
Wait, so what did you change to get it deployed?
So it needed
gcc
???
That's really random lolgo wanted it for some reason
Oh, it's also not using
providers
Fascinating.but, in the railway service, leave root directory, build, and start commands all empty, then just set the config path to
ui.railway.json
it also installs go as a package instead of a provider, since node is the main thing in use
and it only took me two tries to get that config right, I gave up on running it locally
honestly, how the hell do you even write documentation for this type of thingTo be fair I have an incredibly specific use case that's probably rare af, but perhaps it could be added to a mixed environments section in the docs?
I'd call this more of a "mushy environment"
lol, it is quite a mess 🥲
I could have sworn there's a swagger package for node
Maybe "spaghetti environment" is a more accurate description 🤣
Can it analyze Go code and produce a
swagger.json
?oh, then no
also
the resulting image is like 1 point something gigabytes
not ideal
the proper fix for the size would be a custom multi-stage dockerfile, but I'll leave that up to you
I made one of those actually LOL
there was an attempt at least
Just didn't want to figure out how to use it on Railway, and also couldn't run the image locally bc I can't build it on ARM, and had to switch to a different platform, but then I can't run that image bc it's not built for ARM 🫠😭
you know go has an official docker image right?
you're installing go into the node layer
You know what, that probably would've made more sense lol
I am a front end engineer. I have no idea what I'm doing when it comes to this stuff LMAO
and railway will automatically build with a Dockerfile if it finds one present
I'll try Docker if I can't figure this out
Why is the platform merging my configuration?
have you gotten my config file to work?
No, it doesn't work 😿
But I swear it has something to do with
providers
remove all deploys and put all the service settings back to normal
the only non default settings you need to set is the railway config path
I'm going to delete the service and re-create it. Something funky is definitely happening
haha
"Turn it off and on"
Honestly works every time 😂
true
IT WORKED.
What an ordeal ☠️
Thank you so much for your help @Brody, you're awesome 🫰🥹
no problem, sorry I took so long to get you a config file lol