sveltekit service crashing :(
I just deployed my brand new project on Railway and it tried running the
bun run start
command repeatedly which kept failing with the following error:
The service inevitably crashed.121 Replies
Project ID:
12b919b0-8ae8-4936-a695-591b96aa0d64
Perhaps this is because I don't have any adapter setup?
definitely is, you would want to use the node adapter and hope it's compatible with bun, if it's not then you have to use nodejs
Switching to nodejs shouldn't be a problem
Will try adding the node adapter
Tried adding the node adapter. The issue persists.
I doubt this is because of
bun
since it works on my local machine
cc @Brodyterm environment variable not set issue still?
yes
the logs look identical to before adding the adapter
what is your start script
the default? I didn't alter anything on Railway
what is it
checking
nothing?
not quite what I asked
the start script.. in the package.json
Ah!
bun run css && vite build && clear && vite preview
css
being: bunx tailwindcss -i ./src/app.css -o ./dist/tailwind.css
that's not a start script
or at least it shouldn't be yours
what should it be then
just start the node server
haha I've seen the node adapter docs, have you lol
:(
you already run css and build in your build script, why are you running them again?
right so
bun run build && node build
you already run build in your build script, why are you running it again?
OH
oh yeah
lol
it's 2 am here sorry
and while node build might work, you should be more explicit and specify the full path to the JavaScript file that you want to run
I don't have any specific JS file to run?
yes you do
I simply have these
vite build makes one with the node adapter
ah,
build/index.js
have a read š
node build/index.js would use node to run the server, I thought you wanted to use bun?
And you'd be right.
I'm looking for a
bun
equivalent rn lol
But yeah a more critical error would be: Error: Prince#execute: cannot resolve binary "prince" to a filesystem path
š
headed to prince docs
or wait
is there a way to install prince to the project env in Railway?
like I did with SQLC back then
some TOML filewell what is prince
it is a tool that compiles HTML -> PDF
among some other things
I've defined it in my
flake.nix
, but Railway doesn't refer that š
PrinceXML to be preciseis it available as a nix package or an apt package?
nix package
likely both
oh wait it isn't available as a nix package
I wrote my own package for it
it's in the same project folder, is it possible for Railway to refer to that rather than nixpkgs?
is it an overlay?
no, I just wrote my own package for it
very tiny script:
it is available on Ubuntu. I'm guessing that means it's on
apt
, by extension?what's it named
checking
should be
princexml
yeah I can't find it either
looks like you will have to install install prince the same sort of way i install caddy here
https://github.com/brody192/vite-react-template/blob/main/nixpacks.toml
On that note
did the team say anything about flake support?
would fix all my dependency issues
they want to support it natively, its just a low priority because few people use it
:(
I see
Makes perfect sense from a business POV but still a bummer lol
but if you can write nix packages, writing a nixpacks.toml file would be no issue
It's about understanding how the toml works
either way, this script is extremely tiny, so you're right, it should be relatively simple
if you can understand how nix packages work, you can understand nixpacks.toml
yes
BTW, can I not use
bun run preview
as my start script?
it expanding to bun run css && vite preview
that starts a dev server
rip
use bun to run the index.js file
because apparently there's a lot of pain happening
I will just switch to nodejs
its for the better
indeed
invalid use of variables?
ERROR: failed to solve: process "/bin/bash -ol pipefail -c tar -zxvf ${pname}.tar.gz ${pname}" did not complete successfully: exit code: 2
lets see the nixpacks.toml file
it likely won't work as it's the first draft
just wanted to see what breaks
huh
I didn't delete it
you edited it
I don't see it on my screen
do you
you just sent it again, so yes
weird.
full logs please
also whats with the runimage and cmd?
Oh, there is no
princexml
subfolder in the tar.gz
unsure. It's residue from caddy :Pdelete the start phase
also in your princexml phase you may want to copy the resulting binary file into maybe /bin or /usr/bin
since your code prob expects it in path?
yeah so
there is
...tar.gz/foo/install.sh
that I want to run (it does the binary stuff)
where do I put it?
[phases.install]
?run it in the same phase
Okay, and the path would just be /bin?
no, the PATH would be a bunch of different locations
https://utilities.up.railway.app/env-vars?prefix=PATH
not the PATH for prince
the PATH for the binary file
wait
that's the same thing
ah so how do I refer to this env?
or do I have to copy paste/
you dont need to, its just an example?
I see
weird.
idt it threw a 404 before
I copy pasted that URL, replacing
${version}
and it works no problem
wonder why Railway throws a 404
probably a substitution error
Oh I can't reference variables in other variables?
I had done thisno you cant
yeah
realised now
hmm so the build works but this error came back
If the build failed, then I likely need to tell the lib where the binary is
where is it? š
did you put the binary in /bin ?
updated toml:
bruh
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
?????hehe
it can choose
not how it works
that's valid bash, though
okay okay, so I do this?
'./${full_name}/install.sh /bin'
does it even need a path
yes
it can decide itself
this is a line inside
install.sh
Press Enter to accept the default directory or enter an alternative
wait then what is this
current dir
I see
did you write this?
yes
a long while back
who wrote this then
also me
š¤Ø
what are you raising brows for
It's 3 AM, I'm not usually this stupid
okay now
I didn't pass a path
what's the "default"
since I need to tell that to my application
it still doesn't find the binary at whatever the default is
looks like
/usr/local/bin
and that should be in PATHthere is an option in
node-prince
(the npm lib) for setting the binary but that might break local builds unless I remove it locally and keep it in proddo you see the
Installation complete.
message in your build logsyes
so it is in
/usr/local
the prefix
so /usr/local/bin
hmmshould be
and that also should be in PATH, so the npm package should look in PATH automatically
it can download prince for you? why havent you used that?
there is nothing to use?
it doesn't specify anything I'm supposed to do to install prince automatically
read their docs?
they don't have docs IIRC
read the source code?
this readme is all they have
lol ok
Should be this https://github.com/rse/node-prince/blob/master/prince-npm.js#L292-L300
but how do you run the download
as it says here:
in case PrinceXML was not found globally installed at the Node API installation timeso likely the download is automatically done at "Node API installation time"? I found nothing regarding this in my build logs
so then are you trying to overwrite the location in your code?
yes, to wherever it was installed using
./install.sh
the package should find it automatically since it installs it into a folder in PATH
but it doesn't
(āÆĀ°ā”Ā°)āÆļøµ ā»āā»
sounds like something is misconfigured
the error originates from here: https://github.com/rse/node-prince/blob/master/prince-api.js#L281-L293
then specify /bin as the install path
why so?
I wasn't asking why should I specify
/bin
in the install path
I was asking why /bin
specifically
This is an issue upstream. It can't detect NixOS as a Linux distribution
Being punished for being curious oof