#sveltekit service crashing :(
215 messages · Page 1 of 1 (latest)
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
Tried adding the node adapter. The issue persists.
I doubt this is because of bun since it works on my local machine
cc @civic locust
term environment variable not set issue still?
what is your start script
the default? I didn't alter anything on Railway
what is it
checking
nothing?
Ah!
bun run css && vite build && clear && vite preview
css being: bunx tailwindcss -i ./src/app.css -o ./dist/tailwind.css
"scripts": {
"css": "bunx tailwindcss -i ./src/app.css -o ./dist/tailwind.css",
"dev": "bun run css && vite dev",
"build": "bun run css && vite build",
"preview": "bun run css && vite preview",
"start": "bun run css && vite build && clear && vite preview"
},
what should it be then
just start the node server
so bun run css && vite build && node build?
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?
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 file
well 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 precise
is 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:
{ autoPatchelfHook, fetchurl, fontconfig, glibc, stdenv }:
stdenv.mkDerivation rec {
pname = "princexml";
version = "15.1";
src = fetchurl {
url = "https://www.princexml.com/download/prince-${version}-linux-generic-x86_64.tar.gz";
hash = "sha256-rm0GeKPa8iDXBhW52GNcja09Qb+aYUtvFaxZUFHEOTw=";
};
nativeBuildInputs = [ autoPatchelfHook ];
buildInputs = [
fontconfig
glibc
];
installPhase = ''
./install.sh $out
ln -sf /var/lib/prince/license.dat $out/lib/prince/license/license.dat
'';
}
it is available on Ubuntu. I'm guessing that means it's on apt, by extension?
what's it named
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
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
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
# https://nixpacks.com/docs/configuration/file
[variables]
pname = 'princexml'
version = '15.1'
[phases.setup]
nixPkgs = ['...', 'corefonts', 'fontconfig', 'glibc']
[phases.princexml]
dependsOn = ['setup'] # make sure this phase runs after the default 'setup' phase
cmds = [
'curl -fsSLo ${pname}.tar.gz "https://www.princexml.com/download/prince-${version}-linux-generic-x86_64.tar.gz"',
'tar -zxvf ${pname}.tar.gz ${pname}',
'chmod +x ${pname}'
]
[start]
runImage = 'ubuntu:20.04'
cmd = './${pname} 2>&1'
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 :P
delete 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?
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?
[variables]
pname = 'princexml'
version = '15.1'
full_name = 'prince-${version}-linux-generic-x86_64'
I had done this
no you cant
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:
# https://nixpacks.com/docs/configuration/file
[variables]
pname = 'princexml'
full_name = 'prince-15.1-linux-generic-x86_64'
[phases.setup]
nixPkgs = ['...', 'corefonts', 'fontconfig', 'glibc']
[phases.princexml]
dependsOn = ['setup']
cmds = [
'curl -fsSLo ${pname}.tar.gz "https://www.princexml.com/download/${full_name}.tar.gz"',
'tar -zxvf ${pname}.tar.gz ${full_name}',
'chmod +x ${full_name}/install.sh',
'./${full_name}/install.sh /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
]
bruh /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin?????
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
Press Enter to accept the default directory or enter an alternative
wait then what is this
current dir
I see
did you write this?
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 PATH
there 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 prod
do you see the Installation complete. message in your build logs
should be
and that also should be in PATH, so the npm package should look in PATH automatically
here's what the docs for the package say:
Prince#binary(binary): Prince: set the path to the prince(1) binary. By default it is prince (in case PrinceXML was found globally installed at the Node API installation time) or the path to the prince binary of the locally installed PrinceXML distribution (in case PrinceXML was not found globally installed at the Node API installation time). This returns the Prince API for further method chaining.
there is also:
Prince#prefix(prefix): Prince: set the path to the PrinceXML installation. This by default is either empty (in case PrinceXML was found globally installed at the Node API installation time) or the path to the locally installed PrinceXML distribution (in case PrinceXML was not found globally installed at the Node API installation time). This returns the Prince API for further method chaining.
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?
but how do you run the download
as it says here:
in case PrinceXML was not found globally installed at the Node API installation time
so 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
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
