heroku / heroku/buildpacks-nodejs

Errors seem silenced when `yarn --version` check fails

Open
#677 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
28
Forks
17
Avg merge
1d 16h
Merged PRs (30d)
14

Description

I had an app that used a fontawesome api token in the `.yarnrc.yml`. Building this app without the environment variable caused build failures, but the error was not output so it took a few days to figure out the reason.

I think the code for that is [here](https://github.com/heroku/buildpacks-nodejs/blob/f27ea3d583f66959f82bf40f1f73715fa89753bb/buildpacks/nodejs-yarn/src/cmd.rs#L23). My rust isn't great, but I think the buildpack just isn't outputting the errors for the user to see if that check fails.

Here is a `.yarnrc.yml` to use for repro:

```yaml
nodeLinker: node-modules

npmScopes:
fortawesome:
npmAlwaysAuth: true
npmAuthToken: "${FONTAWESOME_NPM_AUTH_TOKEN}"
npmRegistryServer: "https://npm.fontawesome.com/"

yarnPath: .yarn/releases/yarn-3.5.1.cjs
```

And here is the output when that variable is missing and you call `yarn --version`

```
Usage Error: Environment variable not found (FONTAWESOME_NPM_AUTH_TOKEN) in /workspace/.yarnrc.yml (in /workspace/.yarnrc.yml)
```

The same issue exists in the v2a buildpack but that one has a different fix as it is written in shell.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.