coollabsio / coolify

An open-source & self-hostable Heroku / Netlify / Vercel alternative.
https://coolify.io
Apache License 2.0
32.92k stars 1.75k forks source link

[Bug]: Failed To Deploy Bun App #2990

Open iyansr opened 2 months ago

iyansr commented 2 months ago

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?

louisescher commented 2 months ago

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

iyansr commented 2 months ago

@louisescher I will try

iyansr commented 2 months ago

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

louisescher commented 2 months ago

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

iyansr commented 2 months ago

@louisescher Yeah I tried it and failed

image
directormac commented 2 months ago

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 commented 2 months ago

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

iyansr commented 1 month ago

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

iyansr commented 1 month ago

I ended up using Dockerfile instead

abaudhuin commented 1 month ago

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.

JustMrMendez commented 4 weeks ago

any updates?