Asset compiling issue

Hi there!

I have an issue with compiling assets while deploying with propshaft, cssbundling-rails and jsbundling-rails. I thought that this step will be the same as in local, but I see that there is yarn packaging while I tried using bun and everything works locally. When I try to deploy I get:

--------------------
  61 |     ARG JETS_ASSET_HOST
  62 |     COPY jets/scripts/precompile_assets.sh jets/scripts/precompile_assets.sh
  63 | >>> RUN jets/scripts/precompile_assets.sh
  64 |     
  65 |     ###############################################################
--------------------
ERROR: failed to solve: process "/bin/sh -c jets/scripts/precompile_assets.sh" did not complete successfully: exit code: 1
bundler: failed to load command: jets-remote (/codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/bin/jets-remote)
/codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/bundler/gems/jets-4bfcd0f7c7e8/lib/jets/util/sh.rb:13:in `sh': Command failed: docker build --build-arg JETS_ENV=prod --build-arg JETS_PROJECT=shelob --build-arg JETS_ASSET_HOST=https://shelob-prod-s3bucket-jzlx23uvpxws.s3.eu-central-1.amazonaws.com/jets/public --build-arg AWS_ACCESS_KEY_ID=$(cat /t/a | jq -r .AWS_ACCESS_KEY_ID) --build-arg AWS_SECRET_ACCESS_KEY=$(cat /t/a | jq -r .AWS_SECRET_ACCESS_KEY) --build-arg AWS_SESSION_TOKEN=$(cat /t/a | jq -r .AWS_SESSION_TOKEN) --build-arg AWS_REGION=$(cat /t/a | jq -r .AWS_REGION) -t shelob-prod-build-5f17809b . (Jets::Error)
/codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/bundler/gems/jets-4bfcd0f7c7e8/lib/jets/util/sh.rb:29:in `quiet_sh'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/bundler/gems/jets-4bfcd0f7c7e8/lib/jets/util/sh.rb:29:in `quiet_sh'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/bundler/gems/jets-remote-e6356420c4a0/lib/jets/remote/package/build.rb:31:in `build_new_image'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/bundler/gems/jets-remote-e6356420c4a0/lib/jets/remote/package/build.rb:11:in `run'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/bundler/gems/jets-remote-e6356420c4a0/lib/jets/remote/package/abstract/stage_root.rb:19:in `block (4 levels) in run_within_stage_root'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/bundler/gems/jets-remote-e6356420c4a0/lib/jets/remote/package/abstract/stage_root.rb:18:in `chdir'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/bundler/gems/jets-remote-e6356420c4a0/lib/jets/remote/package/abstract/stage_root.rb:18:in `block (3 levels) in run_within_stage_root'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/bundler/gems/jets-remote-e6356420c4a0/lib/jets/remote/package/image.rb:22:in `build'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/bundler/gems/jets-remote-e6356420c4a0/lib/jets/remote/package/image.rb:5:in `deploy_full'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/bundler/gems/jets-remote-e6356420c4a0/lib/jets/remote/package/base.rb:15:in `deploy'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/bundler/gems/jets-remote-e6356420c4a0/lib/jets/remote/package.rb:6:in `deploy'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/bundler/gems/jets-remote-e6356420c4a0/lib/jets/remote/cfn/deploy.rb:11:in `run'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/bundler/gems/jets-remote-e6356420c4a0/lib/jets/remote/cfn/deploy.rb:49:in `run'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/bundler/gems/jets-remote-e6356420c4a0/lib/jets/remote/cli/deploy.rb:8:in `block in run'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/bundler/gems/jets-remote-e6356420c4a0/lib/jets/remote/hooks/concern.rb:6:in `run_hooks'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/bundler/gems/jets-remote-e6356420c4a0/lib/jets/remote/cli/deploy.rb:7:in `run'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/bundler/gems/jets-remote-e6356420c4a0/lib/jets/remote/hooks/managed/docker.rb:8:in `run'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/bundler/gems/jets-remote-e6356420c4a0/lib/jets/remote/hooks/managed/ssh.rb:8:in `run'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/bundler/gems/jets-remote-e6356420c4a0/lib/jets/remote/cli.rb:26:in `deploy'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/gems/thor-1.3.1/lib/thor/command.rb:28:in `run'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/gems/thor-1.3.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/gems/thor-1.3.1/lib/thor.rb:527:in `dispatch'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/bundler/gems/jets-remote-e6356420c4a0/lib/jets/remote/thor/base.rb:102:in `dispatch'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/gems/thor-1.3.1/lib/thor/base.rb:584:in `start'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/bundler/gems/jets-remote-e6356420c4a0/lib/jets/remote/thor/base.rb:28:in `start'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/bundler/gems/jets-remote-e6356420c4a0/exe/jets-remote:7:in `<top (required)>'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/bin/jets-remote:25:in `load'
	from /codebuild/output/src2667748528/src/wrapper/vendor/bundle/ruby/3.2.0/bin/jets-remote:25:in `<top (required)>'
	from /root/.rbenv/versions/3.2.4/lib/ruby/3.2.0/bundler/cli/exec.rb:58:in `load'
	from /root/.rbenv/versions/3.2.4/lib/ruby/3.2.0/bundler/cli/exec.rb:58:in `kernel_load'
	from /root/.rbenv/versions/3.2.4/lib/ruby/3.2.0/bundler/cli/exec.rb:23:in `run'
	from /root/.rbenv/versions/3.2.4/lib/ruby/3.2.0/bundler/cli.rb:492:in `exec'
	from /root/.rbenv/versions/3.2.4/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /root/.rbenv/versions/3.2.4/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /root/.rbenv/versions/3.2.4/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	from /root/.rbenv/versions/3.2.4/lib/ruby/3.2.0/bundler/cli.rb:34:in `dispatch'
	from /root/.rbenv/versions/3.2.4/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	from /root/.rbenv/versions/3.2.4/lib/ruby/3.2.0/bundler/cli.rb:28:in `start'
	from /root/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/libexec/bundle:37:in `block in <top (required)>'
	from /root/.rbenv/versions/3.2.4/lib/ruby/3.2.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
	from /root/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/bundler-2.4.19/libexec/bundle:29:in `<top (required)>'
	from /root/.rbenv/versions/3.2.4/bin/bundle:25:in `load'
	from /root/.rbenv/versions/3.2.4/bin/bundle:25:in `<main>'
Error running command: exit status 1

[Container] 2024/09/03 09:45:33.798433 Command did not exit successfully ./jets-go deploy exit status 1
[Container] 2024/09/03 09:45:33.804283 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: ./jets-go deploy. Reason: exit status 1
[Container] 2024/09/03 09:45:33.859678 Entering phase POST_BUILD
[Container] 2024/09/03 09:45:33.862025 Phase complete: POST_BUILD State: SUCCEEDED
[Container] 2024/09/03 09:45:33.862045 Phase context status code:  Message: 
[Container] 2024/09/03 09:45:33.912489 Set report auto-discover timeout to 5 seconds
[Container] 2024/09/03 09:45:33.912524 Expanding base directory path:  .
[Container] 2024/09/03 09:45:33.915525 Assembling file list
[Container] 2024/09/03 09:45:33.915541 Expanding .
[Container] 2024/09/03 09:45:33.918551 Expanding file paths for base directory .
[Container] 2024/09/03 09:45:33.918565 Assembling file list
[Container] 2024/09/03 09:45:33.918568 Expanding **/*
[Container] 2024/09/03 09:45:33.922216 No matching auto-discover report paths found
[Container] 2024/09/03 09:45:33.922283 Report auto-discover file discovery took 0.009794 seconds
[Container] 2024/09/03 09:45:33.922328 Phase complete: UPLOAD_ARTIFACTS State: SUCCEEDED
[Container] 2024/09/03 09:45:33.922341 Phase context status code:  Message: 
Failed Phases:
BUILD: FAILED

Could this be done with this setup?

I just checked and it all works when I keep using Yarn instead of Bun. I’m not sure if separating packaging managers from jets is something that you want to pursue and is it worth it?

Yes. Unsure if it’s worth it at the moment. Assets can be also compiled locally ahead of deployment. Assets Compile - Jets Serverless Deployment Service Heroku takes a similar approach.

1 Like