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

Render deploys should work after upgrade to Yarn 4 #1638

Open
kbighorse opened this issue Jul 31, 2024 · 3 comments
Open

Render deploys should work after upgrade to Yarn 4 #1638

kbighorse opened this issue Jul 31, 2024 · 3 comments

Comments

@kbighorse
Copy link

Upgrading to Yarn 4 also broke Render deploys.

see #1496

and

https://feedback.render.com/features/p/add-support-for-yarn-2

@kbighorse
Copy link
Author

does anyone have an opinion on this? Are people just not deploying current bullet-train apps to Render atm?

@jagthedrummer
Copy link
Contributor

@kbighorse I don't use Render so I don't know if this will work, but you might try altering your render.yaml so that the buildCommand line looks like this:

buildCommand: "corepack enable && yarn && ./bin/render-build.sh"

Or alternatively you might try updating bin/render-build.sh to look like this:

#!/usr/bin/env bash
# exit on error
set -o errexit

corepack enable
yarn

bundle install
bundle exec rake assets:precompile
bundle exec rake assets:clean

# These are not combined because we want to reload all models after the migrations take place.
# TODO Any way to read these from the `Procfile` where we have the same thing defined for Heroku?
bundle exec rails db:migrate 
bundle exec rails db:seed

Reference: https://community.redwoodjs.com/t/deployment-to-render-yarn-versions/5789

And based on the link you shared it look like you might have to set the SKIP_INSTALL_DEPS ENV var to true, but I don't know how or where you'd do that.

Please report back if you give this a try. If it works we can add it to the repo.

@JeremiahChurch
Copy link

JeremiahChurch commented Nov 6, 2024

I have an open request on the render community forum. I tried a ton of options and I haven't been able to figure out what I'm missing...

render forum thread

I'll update the render.yaml and render-build.sh once I've got a working version

My working changes:

render.yaml

services:
  - type: web
    name: web
    env: ruby
    buildCommand: "./bin/render-build.sh"
    startCommand: "bundle exec puma -C config/puma.rb"
    envVars:
      - key: SKIP_INSTALL_DEPS
        value: true

bin/render-build.sh

#!/usr/bin/env bash
# exit on error
set -o errexit

echo "bundle install starting..."
bundle install

echo "enabling corepack..."
corepack enable 
echo "corepack install..."
corepack install
echo "running yarn..."
yarn

echo "setting yarn version..."
yarn set version 4.2.2

echo "assets precompile starting..."
bundle exec rake assets:precompile

echo "assets clean starting..."
bundle exec rake assets:clean

echo "db:migrate starting..."
bundle exec rails db:migrate 
echo "db:seed starting..."
bundle exec rails db:seed

The current output error in render is

<trimmed> everything above looks as expected
  enabling corepack...
==> Using Node.js version 20.15.0 via /opt/render/project/src/.nvmrc
==> Docs on specifying a Node.js version: https://render.com/docs/node-version
==> Using Bun version 1.1.0 (default)
==> Docs on specifying a bun version: https://render.com/docs/bun-version
corepack install...
Adding yarn@4.2.2 to the cache...
running yarn...
➤ YN0000: · Yarn 4.2.2
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed in 0s 293ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ 620 packages were added to the project (+ 139.01 MiB).
➤ YN0000: └ Completed in 14s 388ms
➤ YN0000: ┌ Link step
➤ YN0007: │ esbuild@npm:0.23.1 must be built because it never has been before or the last one failed
➤ YN0007: │ core-js@npm:3.32.2 must be built because it never has been before or the last one failed
➤ YN0000: │ core-js@npm:3.32.2 STDOUT Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
➤ YN0000: │ core-js@npm:3.32.2 STDOUT 
➤ YN0000: │ core-js@npm:3.32.2 STDOUT The project needs your help! Please consider supporting core-js:
➤ YN0000: │ core-js@npm:3.32.2 STDOUT > https://opencollective.com/core-js 
➤ YN0000: │ core-js@npm:3.32.2 STDOUT > https://patreon.com/zloirock 
➤ YN0000: │ core-js@npm:3.32.2 STDOUT > https://boosty.to/zloirock 
➤ YN0000: │ core-js@npm:3.32.2 STDOUT > bitcoin: bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz 
➤ YN0000: │ core-js@npm:3.32.2 STDOUT 
➤ YN0000: │ core-js@npm:3.32.2 STDOUT I highly recommend reading this: https://github.com/zloirock/core-js/blob/master/docs/2023-02-14-so-whats-next.md 
➤ YN0000: │ core-js@npm:3.32.2 STDOUT 
➤ YN0000: └ Completed in 7s 133ms
➤ YN0000: · Done in 22s 158ms
setting yarn version...
➤ YN0000: Done in 0s 10ms
assets precompile starting...
error This project's package.json defines "packageManager": "yarn@4.2.2". However the current global version of Yarn is 1.22.22.
Presence of the "packageManager" field indicates that the project is meant to be used with Corepack, a tool included by default with all official Node.js distributions starting from 16.9 and 14.19.
Corepack must currently be enabled by running corepack enable in your terminal. For more information, check out https://yarnpkg.com/corepack.
rake aborted!
jsbundling-rails: Command install failed, ensure yarn is installed
/opt/render/project/.gems/ruby/3.3.0/gems/jsbundling-rails-1.3.1/lib/tasks/jsbundling/build.rake:6:in `block (2 levels) in <main>'

edit: even going as far as removing the packageManager from the package.json didn't fix the issue and the error still complained about the variable in the package.json.... I'm so confused.

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

3 participants