Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Failed To Deploy Bun App #2990

Closed
1 of 2 tasks
iyansr opened this issue Aug 2, 2024 · 15 comments
Closed
1 of 2 tasks

[Bug]: Failed To Deploy Bun App #2990

iyansr opened this issue Aug 2, 2024 · 15 comments

Comments

@iyansr
Copy link

iyansr commented Aug 2, 2024

Description

Error when deploy Bun App (Elysia)

Minimal Reproduction (if possible, example repository)

Deploy Bare minium Bun app with Elysia Framework with Nixpack: https://github.com/iyansr/test-elysia

The error log says ERROR: failed to solve: process "/bin/bash -ol pipefail -c bun i --no-save" did not complete successfully: exit code: 132

Exception or Error

[2024-Aug-02 03:29:03.556415] Starting deployment of iyansr/test-elysia:main to localhost.
[2024-Aug-02 03:29:03.779226] Preparing container with helper image: ghcr.io/coollabsio/coolify-helper:latest.
[2024-Aug-02 03:29:07.559904] Image not found (igowo4c:33c63fa4597c7ec8d4d74cfbf79e1620ef1c5e21). Building new image.
[2024-Aug-02 03:29:07.996401] ----------------------------------------
[2024-Aug-02 03:29:08.003692] Importing iyansr/test-elysia:main (commit sha HEAD) to /artifacts/lscgckg.
[2024-Aug-02 03:29:10.668657] Generating nixpacks configuration with: nixpacks plan -f toml /artifacts/lscgckg
[2024-Aug-02 03:29:11.212251] Found application type: node.
[2024-Aug-02 03:29:11.215882] If you need further customization, please check the documentation of Nixpacks: https://nixpacks.com/docs/providers/node
[2024-Aug-02 03:29:12.128105] ----------------------------------------
[2024-Aug-02 03:29:12.132614] Building docker image started.
[2024-Aug-02 03:29:12.136659] To check the current progress, click on Show Debug Logs.
[2024-Aug-02 03:29:17.917481] Oops something is not okay, are you okay? 😢

[2024-Aug-02 03:29:17.921747] #0 building with "default" instance using docker driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 979B 0.0s done
#1 DONE 0.1s

#2 [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1716249803
#2 DONE 1.3s

#3 [internal] load .dockerignore
#3 transferring context: 2B done
#3 DONE 0.1s

#4 [stage-0 1/9] FROM ghcr.io/railwayapp/nixpacks:ubuntu-1716249803@sha256:5ef4d2021c418fcaabb56cea5ea9e24a5fdedfe27f58062d9689214dfed45c46
#4 DONE 0.0s

#5 [internal] load build context
#5 transferring context: 21.08kB 0.0s done
#5 DONE 0.1s

#6 [stage-0 3/9] COPY .nixpacks/nixpkgs-bdd2f439c62aa0b8aa97f5c784a965c23f968fe6.nix .nixpacks/nixpkgs-bdd2f439c62aa0b8aa97f5c784a965c23f968fe6.nix
#6 CACHED

#7 [stage-0 4/9] RUN nix-env -if .nixpacks/nixpkgs-bdd2f439c62aa0b8aa97f5c784a965c23f968fe6.nix && nix-collect-garbage -d
#7 CACHED

#8 [stage-0 2/9] WORKDIR /app/
#8 CACHED

#9 [stage-0 5/9] RUN sudo apt-get update && sudo apt-get install -y --no-install-recommends curl wget
#9 CACHED

#10 [stage-0 6/9] COPY . /app/.
#10 DONE 0.4s

#11 [stage-0 7/9] RUN --mount=type=cache,id=igowo4c-/root/bun,target=/root/.bun bun i --no-save
#11 ERROR: process "/bin/bash -ol pipefail -c bun i --no-save" did not complete successfully: exit code: 132
------
> [stage-0 7/9] RUN --mount=type=cache,id=igowo4c-/root/bun,target=/root/.bun bun i --no-save:
------
Dockerfile:20
--------------------
18 | ENV NIXPACKS_PATH /app/node_modules/.bin:$NIXPACKS_PATH
19 | COPY . /app/.
20 | >>> RUN --mount=type=cache,id=igowo4c-/root/bun,target=/root/.bun bun i --no-save
21 |
22 | # build phase
--------------------
ERROR: failed to solve: process "/bin/bash -ol pipefail -c bun i --no-save" did not complete successfully: exit code: 132

[2024-Aug-02 03:29:17.927167] Deployment failed. Removing the new version of your application.

Version

v4.0.0-beta.319

Cloud?

  • Yes
  • No
@louisescher
Copy link

louisescher commented Aug 4, 2024

I've cloned your repo and deployed it on my instance, it works fine for me. Did you modify the install command? Normally, Nixpacks should just run bun install and nothing else. Also, your package.json doesn't include any build and start steps. If you just want to run the development build on Coolify, change the start command to bun dev:

image

The Elysia documentation also provides info about the scripts normally included in the package.json file:
https://elysiajs.com/quick-start.html#manual-installation

@andrasbacsai andrasbacsai added the 💤 Waiting for feedback Issues awaiting a response from the author. label Aug 5, 2024
@iyansr
Copy link
Author

iyansr commented Aug 6, 2024

@louisescher I will try

@iyansr
Copy link
Author

iyansr commented Aug 6, 2024

I try to update my package.json and modify the start command, the error still appear

@louisescher
Copy link

Can you try and change the install command to bun install via Coolify? Since the issue is seemingly caused by the install command

@iyansr
Copy link
Author

iyansr commented Aug 6, 2024

@louisescher Yeah I tried it and failed

image

@directormac
Copy link

Is you run start command in your local machine does it work? IF you want to use the built one it's usually in dist, or depending on your tsconfig. this is not a coolify issue.

@iyansr
Copy link
Author

iyansr commented Aug 12, 2024

All install, run, build commad working fine on my machine, Is it nixpacks related bug?

@iyansr
Copy link
Author

iyansr commented Aug 19, 2024

I tried to re install coolify, Stil didnt solve the issue

@iyansr
Copy link
Author

iyansr commented Aug 20, 2024

I ended up using Dockerfile instead

@iyansr iyansr closed this as completed Aug 20, 2024
@abaudhuin
Copy link

abaudhuin commented Sep 7, 2024

I reproduce this on a fresh coolify install with a vanilla create-t3-app project.
Running nixpacks build locally works fine but it fails in coolify.
Anyone has an idea how to get more logs on why bun install fails?
My local nix plan is almost identical to the one on coolify too.

@peaklabs-dev peaklabs-dev reopened this Sep 7, 2024
@JustMrMendez
Copy link
Contributor

any updates?

@peaklabs-dev peaklabs-dev removed the 💤 Waiting for feedback Issues awaiting a response from the author. label Sep 26, 2024
@JonathanRiche
Copy link

i got bun install via nixpaxcks Jared mentioned on Ubuntu if build-essential is missing you can have issues see this tweet :
Bun-coolify Issue ->

[phases.setup]
nixPkgs = ['bun']
aptPkgs = ['build-essential']

[phases.install]
cmds = ['bun install --ignore-scripts']

[phases.build]
cmds = ['bun run build']

[start]
cmd = 'bun run build/index.js'

@JonathanRiche
Copy link

JonathanRiche commented Nov 2, 2024

That toml snippet I shared just needs to be saved as nixpacks.toml at the root of your project and in your coolify configuration(ui) make sure Nixpacks is set (it's usually the default) also the build and run scripts would need to be yours for elysia commands

@SyahmiRafsan
Copy link

SyahmiRafsan commented Nov 12, 2024

That toml snippet I shared just needs to be saved as nixpacks.toml at the root of your project and in your coolify configuration(ui) make sure Nixpacks is set (it's usually the default) also the build and run scripts would need to be yours for elysia commands

Added the nixpacks to my root folder but still getting the same error:

Importing SyahmiRafsan/pm-monorepo:main (commit sha HEAD) to /artifacts/bc8448044gg8so08k8ggwo48.
Generating nixpacks configuration with: nixpacks plan -f toml  --start-cmd "bun start" --install-cmd "bun install --ignore-scripts" /artifacts/bc8448044gg8so08k8ggwo48/apps/hono
Found application type: node.
If you need further customization, please check the documentation of Nixpacks: https://nixpacks.com/docs/providers/node
----------------------------------------
Building docker image started.
To check the current progress, click on Show Debug Logs.
Oops something is not okay, are you okay? 😢
#0 building with "default" instance using docker driver
#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 1.04kB 0.0s done
#1 DONE 0.1s
#2 [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1727136237
#2 DONE 0.9s
#3 [internal] load .dockerignore
#3 transferring context: 2B done
#3 DONE 0.0s
#4 [stage-0 1/9] FROM ghcr.io/railwayapp/nixpacks:ubuntu-![Image](https://github.com/user-attachments/assets/de50482e-20f6-4413-b88f-705d89b1dc31)
1727136237@sha256:72cd12021740b1c4100a5c53c3b22974dacb86e4b0a35fcdd12605339de25b86
#4 DONE 0.0s
#5 [internal] load build context
#5 transferring context: 5.91kB 0.0s done
#5 DONE 0.1s
#6 [stage-0 4/9] RUN nix-env -if .nixpacks/nixpkgs-e05605ec414618eab4a7a6aea8b38f6fbbcc8f08.nix && nix-collect-garbage -d
#6 CACHED
#7 [stage-0 2/9] WORKDIR /app/
#7 CACHED
#8 [stage-0 3/9] COPY .nixpacks/nixpkgs-e05605ec414618eab4a7a6aea8b38f6fbbcc8f08.nix .nixpacks/nixpkgs-e05605ec414618eab4a7a6aea8b38f6fbbcc8f08.nix
#8 CACHED
#9 [stage-0 5/9] RUN sudo apt-get update && sudo apt-get install -y --no-install-recommends build-essential curl wget
#9 CACHED
#10 [stage-0 6/9] COPY . /app/.
#10 DONE 0.2s
#11 [stage-0 7/9] RUN --mount=type=cache,id=x4ogw0csk8k0oco440ow0c8g-/root/npm,target=/root/.npm bun install --ignore-scripts
#11 0.297 ============================================================
#11 0.297 Bun v1.1.20 (ae194892) Linux x64
#11 ERROR: process "/bin/bash -ol pipefail -c bun install --ignore-scripts" did not complete successfully: exit code: 132
------
 > [stage-0 7/9] RUN --mount=type=cache,id=x4ogw0csk8k0oco440ow0c8g-/root/npm,target=/root/.npm bun install --ignore-scripts:
0.297 ============================================================
0.297 Bun v1.1.20 (ae194892) Linux x64
------
Dockerfile:20
--------------------
  18 |     ENV NIXPACKS_PATH=/app/node_modules/.bin:$NIXPACKS_PATH
  19 |     COPY . /app/.
  20 | >>> RUN --mount=type=cache,id=x4ogw0csk8k0oco440ow0c8g-/root/npm,target=/root/.npm bun install --ignore-scripts
  21 |     
  22 |     # build phase
--------------------
ERROR: failed to solve: process "/bin/bash -ol pipefail -c bun install --ignore-scripts" did not complete successfully: exit code: 132

This is my nixpacks config shown when building the docker image:

Building docker image started.
To check the current progress, click on Show Debug Logs.
docker exec mwwgcggwssoo04444c884wow bash -c 'nixpacks build -c /artifacts/thegameplan.json --cache-key 'x4ogw0csk8k0oco440ow0c8g' --no-error-without-start -n x4ogw0csk8k0oco440ow0c8g:d68fbd00cda7bb5866cc538ec83a107fd22cd9a4 /artifacts/mwwgcggwssoo04444c884wow/apps/hono -o /artifacts/mwwgcggwssoo04444c884wow/apps/hono'
╔═══════════════ Nixpacks v1.29.0 ══════════════╗
║ setup      │ bun, build-essential, curl, wget ║
║───────────────────────────────────────────────║
║ install    │ bun install                      ║
║───────────────────────────────────────────────║
║ build      │ bun run build                    ║
║───────────────────────────────────────────────║
║ start      │ bun run start                    ║
╚═══════════════════════════════════════════════╝

Here is my nixpacks:

[phases.setup]
nixPkgs = ['bun']
aptPkgs = ['build-essential']

[phases.install]
cmds = ['bun install --ignore-scripts']

# [phases.build]
# cmds = ['bun run build']

[start]
cmd = 'bun run start'

Image

@peaklabs-dev
Copy link
Member

This issue is most likely not a Bug inside Coolify and just a configuration problem. So I will close this. If you still need help you can ask on our Discord and someone might be able to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants