redwoodjs / redwood

The App Framework for Startups
https://redwoodjs.com
MIT License
17.15k stars 979 forks source link

[Bug?]: Redwoodjs flightcontrol web deployment failing #7641

Open joeyhotz opened 1 year ago

joeyhotz commented 1 year ago

What's not working?

Trying to deploy a redwoodjs app using flightcontrol but it's failing on the web deploy.

23:10:09: #11 [stage-0  7/10] RUN --mount=type=cache,id=G72QpPNA6IY-/usr/local/share/cache/yarn/v6,target=/usr/local/share/.cache/yarn/v6 yarn install --frozen-lockfile --production=false
23:10:09: #11 sha256:c208f887ecb2757f26463319fe37c6cecde6a3d1747e5f08aac6479613951034
23:10:09: #11 0.826 Unknown Syntax Error: Invalid option name ("--production=false").
23:10:09: #11 0.826 
23:10:09: #11 0.826 $ yarn install [--json] [--immutable] [--immutable-cache] [--check-cache] [--inline-builds] [--mode #0]
23:10:09: #11 ERROR: executor failed running [/bin/bash -ol pipefail -c yarn install --frozen-lockfile --production=false]: exit code: 1

How do we reproduce the bug?

Running the script with yarn v3. I believe that whatever script it is running is only built to support yarn v1 as production=false doesn't seem to be valid input anymore.

https://classic.yarnpkg.com/lang/en/docs/cli/install/

What's your environment? (If it applies)

System:
    OS: macOS 13.2
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.14.0 - /private/var/folders/db/llk2s_1s1ysbjl6n7p_d860h0000gp/T/xfs-fde3fc5f/node
    Yarn: 3.4.1 - /private/var/folders/db/llk2s_1s1ysbjl6n7p_d860h0000gp/T/xfs-fde3fc5f/yarn
  Databases:
    SQLite: 3.39.5 - /usr/bin/sqlite3
  Browsers:
    Chrome: 109.0.5414.119
    Safari: 16.3
  npmPackages:
    @redwoodjs/core: 4.1.3 => 4.1.3

Are you interested in working on this?

rgrativol commented 1 year ago

This seems to be an issue with the buildpack used by Flightcontrol. There is a similar one opened HERE. As a workaround, you can edit your flightcontrol.json and add the following line above the "buildCommand" definition of both API and web:

"installCommand": "NODE_ENV=development yarn install --frozen-lockfile",

It will have the same result of having --production=false.

Your service will look like:

 {
          "id": "redwood-api",
          "name": "Redwood API",
          "type": "fargate",
          "buildType": "nixpacks",
          "cpu": 0.25,
          "memory": 0.5,
          "installCommand": "NODE_ENV=development yarn install --frozen-lockfile",
          "buildCommand": "yarn rw deploy flightcontrol api",
          "startCommand": "yarn rw deploy flightcontrol api --serve",
          "port": 8911,
          "healthCheckPath": "/graphql/health",
          "envVariables": {
            "REDWOOD_WEB_URL": {
              "fromService": {
                "id": "redwood-web",
                "value": "origin"
              }
            },
            "DATABASE_URL": {
              "fromService": {
                "id": "db",
                "value": "dbConnectionString"
              }
            }
          }
        },
jtoar commented 1 year ago

Thanks @rgrativol! One thing I'd add: use --immutable instead of --frozen-lockfile. They're the same thing, but yarn plans to remove the latter at some point (according to their docs: https://yarnpkg.com/cli/install#details).

I'll try reproducing this and see if I can get in touch with the flightcontrol team to get this working out of the gate.

clarkbw commented 1 year ago

I received the same error building the web deployment on render.com but was able to fix it by passing the env SKIP_INSTALL_DEPS=true and running yarn on my own.

Fix found via this https://community.render.com/t/support-for-yarn-2-workspaces/135/4 and should be the default env for Render.

Feb 22 12:31:34 AM  ==> Cloning from https://github.com/clarkbw/...
Feb 22 12:31:34 AM  ==> Checking out commit 41b20c650aca7017108ef1de2e5448bb92694cd7 in branch main
Feb 22 12:31:38 AM  ==> Detected Node version 16.19.1
Feb 22 12:31:40 AM  ==> Installing dependencies with Yarn...
Feb 22 12:31:40 AM  Unknown Syntax Error: Invalid option name ("--production=false").
Feb 22 12:31:40 AM  
Feb 22 12:31:40 AM  $ yarn install [--json] [--immutable] [--immutable-cache] [--check-cache] [--inline-builds] [--mode #0]
jamesmurdza commented 1 year ago

@rgrativol Your solution solved the problem for me. Thanks.