R
Railway•14mo ago
Michael

deploy bun 1.0 project

does anyone know if and how thats possible on railway currently?
48 Replies
Percy
Percy•14mo ago
Project ID: N/A
Brody
Brody•14mo ago
try adding this as a nixpacks.toml file to your project
[phases.setup]
nixpkgsArchive = 'c054b2a07bce2be3b85fed85f45aea6a4b97f5cc'
[phases.setup]
nixpkgsArchive = 'c054b2a07bce2be3b85fed85f45aea6a4b97f5cc'
reference https://github.com/NixOS/nixpkgs/commit/c054b2a07bce2be3b85fed85f45aea6a4b97f5cc
Michael
Michael•14mo ago
i will try that thank you it failed 😦
Brody
Brody•14mo ago
logs please
Michael
Michael•14mo ago
#12 ERROR: process "/bin/bash -ol pipefail -c bun build" did not complete successfully: exit code: 1

-----

> [stage-0 8/10] RUN --mount=type=cache,id=s/e19bc981-d4b3-4d83-95f8-894c7442cd72-node_modules/cache,target=/app/node_modules/.cache bun build:

0.266 bun build ./src/index.ts --outfile=bundle.js

0.266 bun build --minify --splitting --outdir=out ./index.jsx ./lib/worker.ts

0.266



0.266 Bundle code to be run in Bun (reduces server startup time)

0.266 bun build --target=bun ./server.ts --outfile=server.js

0.266

0.266 Creating a standalone executable (see https://bun.sh/docs/bundler/executables)

0.266 bun build --compile ./cli.ts --outfile=my-app

0.266

0.266 A full list of flags is available at https://bun.sh/docs/bundler

-----

Dockerfile:24

-------------------

22 | # build phase

23 | COPY . /app/.

24 | >>> RUN --mount=type=cache,id=s/e19bc981-d4b3-4d83-95f8-894c7442cd72-node_modules/cache,target=/app/node_modules/.cache bun build



25 |

26 |

-------------------

ERROR: failed to solve: process "/bin/bash -ol pipefail -c bun build" did not complete successfully: exit code: 1



Error: Docker build failed
#12 ERROR: process "/bin/bash -ol pipefail -c bun build" did not complete successfully: exit code: 1

-----

> [stage-0 8/10] RUN --mount=type=cache,id=s/e19bc981-d4b3-4d83-95f8-894c7442cd72-node_modules/cache,target=/app/node_modules/.cache bun build:

0.266 bun build ./src/index.ts --outfile=bundle.js

0.266 bun build --minify --splitting --outdir=out ./index.jsx ./lib/worker.ts

0.266



0.266 Bundle code to be run in Bun (reduces server startup time)

0.266 bun build --target=bun ./server.ts --outfile=server.js

0.266

0.266 Creating a standalone executable (see https://bun.sh/docs/bundler/executables)

0.266 bun build --compile ./cli.ts --outfile=my-app

0.266

0.266 A full list of flags is available at https://bun.sh/docs/bundler

-----

Dockerfile:24

-------------------

22 | # build phase

23 | COPY . /app/.

24 | >>> RUN --mount=type=cache,id=s/e19bc981-d4b3-4d83-95f8-894c7442cd72-node_modules/cache,target=/app/node_modules/.cache bun build



25 |

26 |

-------------------

ERROR: failed to solve: process "/bin/bash -ol pipefail -c bun build" did not complete successfully: exit code: 1



Error: Docker build failed
can i provide a Project ID afterwards Maybe that would be easier for you?
Brody
Brody•14mo ago
please enclose the logs in triple backticks
Michael
Michael•14mo ago
done
Brody
Brody•14mo ago
full build logs please
Michael
Michael•14mo ago


#10 1.108 + @sveltejs/[email protected]

#10 1.108 + @sveltejs/[email protected]

#10 1.108 + [email protected]

#10 1.108 + [email protected]

#10 1.108 + [email protected]

#10 1.108 + [email protected]

#10 1.108 + [email protected]

#10 1.108 + [email protected]



#10 1.108 + @tailwindcss/[email protected]

#10 1.108

#10 1.108 141 packages installed [829.00ms]



#10 DONE 1.2s





#11 [stage-0 7/10] COPY . /app/.

#11 DONE 0.0s



#12 [stage-0 8/10] RUN --mount=type=cache,id=s/e19bc981-d4b3-4d83-95f8-894c7442cd72-node_modules/cache,target=/app/node_modules/.cache bun build



#12 0.266 bun build v1.0.0 (822a00c4)

#12 0.266 error: Missing entrypoints. What would you like to bundle?

#12 0.266

#12 0.266 Usage: bun build [flags] [...entrypoints]

#12 0.266

#12 0.266 Common Flags:

#12 0.266 --outfile Write the output to a specific file (default: stdout)

#12 0.266 --outdir Write the output to a directory (required for splitting)

#12 0.266 --minify Enable all minification flags

#12 0.266 --minify-whitespace Remove unneeded whitespace



#12 0.266 --minify-syntax Transform code to use less syntax

#12 0.266 --minify-identifiers Shorten variable names

#12 0.266 --sourcemap Generate sourcemaps

#12 0.266 ("none", "inline", or "external")

#12 0.266 --target The intended execution environment for the bundle.

#12 0.266 ("browser", "bun" or "node")

#12 0.266 --splitting Enable code splitting (requires --outdir)

#12 0.266

#12 0.266 Examples:

#12 0.266 Frontend web apps:

#12 0.266 bun build ./src/index.ts --outfile=bundle.js

#12 0.266 bun build --minify --splitting --outdir=out ./index.jsx ./lib/worker.ts

#12 0.266

#12 0.266 Bundle code to be run in Bun (reduces server startup time)

#12 0.266 bun build --target=bun ./server.ts --outfile=server.js

#12 0.266

#12 0.266 Creating a standalone executable (see https://bun.sh/docs/bundler/executables)

#12 0.266 bun build --compile ./cli.ts --outfile=my-app

#12 0.266

#12 0.266 A full list of flags is available at https://bun.sh/docs/bundler



#12 ERROR: process "/bin/bash -ol pipefail -c bun build" did not complete successfully: exit code: 1

-----

> [stage-0 8/10] RUN --mount=type=cache,id=s/e19bc981-d4b3-4d83-95f8-894c7442cd72-node_modules/cache,target=/app/node_modules/.cache bun build:

0.266 bun build ./src/index.ts --outfile=bundle.js

0.266 bun build --minify --splitting --outdir=out ./index.jsx ./lib/worker.ts

0.266



0.266 Bundle code to be run in Bun (reduces server startup time)

0.266 bun build --target=bun ./server.ts --outfile=server.js

0.266

0.266 Creating a standalone executable (see https://bun.sh/docs/bundler/executables)

0.266 bun build --compile ./cli.ts --outfile=my-app

0.266

0.266 A full list of flags is available at https://bun.sh/docs/bundler

-----

Dockerfile:24

-------------------

22 | # build phase

23 | COPY . /app/.

24 | >>> RUN --mount=type=cache,id=s/e19bc981-d4b3-4d83-95f8-894c7442cd72-node_modules/cache,target=/app/node_modules/.cache bun build



25 |

26 |

-------------------

ERROR: failed to solve: process "/bin/bash -ol pipefail -c bun build" did not complete successfully: exit code: 1



Error: Docker build failed




#10 1.108 + @sveltejs/[email protected]

#10 1.108 + @sveltejs/[email protected]

#10 1.108 + [email protected]

#10 1.108 + [email protected]

#10 1.108 + [email protected]

#10 1.108 + [email protected]

#10 1.108 + [email protected]

#10 1.108 + [email protected]



#10 1.108 + @tailwindcss/[email protected]

#10 1.108

#10 1.108 141 packages installed [829.00ms]



#10 DONE 1.2s





#11 [stage-0 7/10] COPY . /app/.

#11 DONE 0.0s



#12 [stage-0 8/10] RUN --mount=type=cache,id=s/e19bc981-d4b3-4d83-95f8-894c7442cd72-node_modules/cache,target=/app/node_modules/.cache bun build



#12 0.266 bun build v1.0.0 (822a00c4)

#12 0.266 error: Missing entrypoints. What would you like to bundle?

#12 0.266

#12 0.266 Usage: bun build [flags] [...entrypoints]

#12 0.266

#12 0.266 Common Flags:

#12 0.266 --outfile Write the output to a specific file (default: stdout)

#12 0.266 --outdir Write the output to a directory (required for splitting)

#12 0.266 --minify Enable all minification flags

#12 0.266 --minify-whitespace Remove unneeded whitespace



#12 0.266 --minify-syntax Transform code to use less syntax

#12 0.266 --minify-identifiers Shorten variable names

#12 0.266 --sourcemap Generate sourcemaps

#12 0.266 ("none", "inline", or "external")

#12 0.266 --target The intended execution environment for the bundle.

#12 0.266 ("browser", "bun" or "node")

#12 0.266 --splitting Enable code splitting (requires --outdir)

#12 0.266

#12 0.266 Examples:

#12 0.266 Frontend web apps:

#12 0.266 bun build ./src/index.ts --outfile=bundle.js

#12 0.266 bun build --minify --splitting --outdir=out ./index.jsx ./lib/worker.ts

#12 0.266

#12 0.266 Bundle code to be run in Bun (reduces server startup time)

#12 0.266 bun build --target=bun ./server.ts --outfile=server.js

#12 0.266

#12 0.266 Creating a standalone executable (see https://bun.sh/docs/bundler/executables)

#12 0.266 bun build --compile ./cli.ts --outfile=my-app

#12 0.266

#12 0.266 A full list of flags is available at https://bun.sh/docs/bundler



#12 ERROR: process "/bin/bash -ol pipefail -c bun build" did not complete successfully: exit code: 1

-----

> [stage-0 8/10] RUN --mount=type=cache,id=s/e19bc981-d4b3-4d83-95f8-894c7442cd72-node_modules/cache,target=/app/node_modules/.cache bun build:

0.266 bun build ./src/index.ts --outfile=bundle.js

0.266 bun build --minify --splitting --outdir=out ./index.jsx ./lib/worker.ts

0.266



0.266 Bundle code to be run in Bun (reduces server startup time)

0.266 bun build --target=bun ./server.ts --outfile=server.js

0.266

0.266 Creating a standalone executable (see https://bun.sh/docs/bundler/executables)

0.266 bun build --compile ./cli.ts --outfile=my-app

0.266

0.266 A full list of flags is available at https://bun.sh/docs/bundler

-----

Dockerfile:24

-------------------

22 | # build phase

23 | COPY . /app/.

24 | >>> RUN --mount=type=cache,id=s/e19bc981-d4b3-4d83-95f8-894c7442cd72-node_modules/cache,target=/app/node_modules/.cache bun build



25 |

26 |

-------------------

ERROR: failed to solve: process "/bin/bash -ol pipefail -c bun build" did not complete successfully: exit code: 1



Error: Docker build failed


ok for some reason i cant copy everything
Brody
Brody•14mo ago
that will do looks like that error output gives you a pretty good idea of how to fix this build issue?
Michael
Michael•14mo ago
im not sure what way would work for railway
Brody
Brody•14mo ago
so what kind of app is this?
Michael
Michael•14mo ago
a svelte-kit full stack app
Brody
Brody•14mo ago
do you develop with bun 1.0 locally?
Michael
Michael•14mo ago
yep
Brody
Brody•14mo ago
vite + sveltekit?
Michael
Michael•14mo ago
yes
Brody
Brody•14mo ago
send me the scripts section of your package.json
Michael
Michael•14mo ago
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview"
},
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview"
},
Brody
Brody•14mo ago
can you run bun build locally without issue?
Michael
Michael•14mo ago
oh no it throws the same missing entrypoints
Brody
Brody•14mo ago
well if it doesnt work locally its unlikely to work on railway, get it working locally first, let me know when you have that done 🙂
Michael
Michael•14mo ago
alright oh nvm it actually works just the command is bun run build and not bun build
Brody
Brody•14mo ago
cool, also you seem to be missing a start command?
Michael
Michael•14mo ago
uhm yeah
Brody
Brody•14mo ago
youre gonna need one lol
Michael
Michael•14mo ago
good idea i think it works now
Brody
Brody•14mo ago
what was the start command you are using now
Michael
Michael•14mo ago
"start": "node ./build/index.js" and then bun run start
Brody
Brody•14mo ago
bruh
Michael
Michael•14mo ago
i think thats how you do it with svelte kit right
Brody
Brody•14mo ago
you dont see what you did wrong?
Michael
Michael•14mo ago
uhm no what did i do wrong it works i think?
Brody
Brody•14mo ago
"start": "node ./build/index.js" node
Michael
Michael•14mo ago
😂 well
Brody
Brody•14mo ago
thought you wanted to use bun
Michael
Michael•14mo ago
i mean yeah XD
Brody
Brody•14mo ago
see what you did wrong now? lol
Michael
Michael•14mo ago
yes thanks lmao im too tired
Brody
Brody•14mo ago
so tired your eyes are fully closed
Michael
Michael•14mo ago
no i just copy pasted it from another project forgetting that i use bun now instead of node 😂 thanks for the help @Brody
Brody
Brody•14mo ago
well does it work with bun in place of node?
Michael
Michael•14mo ago
yes
Brody
Brody•14mo ago
awsome
Chen
Chen•14mo ago
do we need this?
Brody
Brody•14mo ago
to use bun 1.0, yes, otherwise some bun 0.4x version will be used
Michael
Michael•14mo ago
is this automatically using the latest version for example 1.0.2 now ?
Brody
Brody•14mo ago
no, that fixes it to 1.0 add this (or update the archive hash) in your nixpacks.toml to fix the bun version to 1.0.2 referance: https://github.com/NixOS/nixpkgs/commit/d68b3b0c914aea10eee7cf2e59ef44e39bc221c9
[phases.setup]
nixpkgsArchive = 'd68b3b0c914aea10eee7cf2e59ef44e39bc221c9' # https://github.com/NixOS/nixpkgs/commit/d68b3b0c914aea10eee7cf2e59ef44e39bc221c9
[phases.setup]
nixpkgsArchive = 'd68b3b0c914aea10eee7cf2e59ef44e39bc221c9' # https://github.com/NixOS/nixpkgs/commit/d68b3b0c914aea10eee7cf2e59ef44e39bc221c9
Want results from more Discord servers?
Add your server