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

Use a more reliable way to convert to string #2059

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

bor0
Copy link
Member

@bor0 bor0 commented Oct 16, 2024

Description

Due to the recent MFA changes, my role was demoted to Member instead of Admin. When I tried to run vip @97.production config envvar get-all, the variables had the value of null, which caused the following error:

$ vip @97.production config envvar get-all
✕ Please contact VIP Support with the following information:
TypeError: Cannot read properties of null (reading 'toString')
    at /Users/bor0/.nvm/versions/node/v18.11.0/lib/node_modules/@automattic/vip/dist/lib/cli/format.js:75:50
    at Array.map (<anonymous>)
    at /Users/bor0/.nvm/versions/node/v18.11.0/lib/node_modules/@automattic/vip/dist/lib/cli/format.js:75:24
    at Array.forEach (<anonymous>)
    at table (/Users/bor0/.nvm/versions/node/v18.11.0/lib/node_modules/@automattic/vip/dist/lib/cli/format.js:74:8)
    at formatData (/Users/bor0/.nvm/versions/node/v18.11.0/lib/node_modules/@automattic/vip/dist/lib/cli/format.js:37:14)
    at getAllEnvVarsCommand (/Users/bor0/.nvm/versions/node/v18.11.0/lib/node_modules/@automattic/vip/dist/bin/vip-config-envvar-get-all.js:86:38)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async _args.default.argv (/Users/bor0/.nvm/versions/node/v18.11.0/lib/node_modules/@automattic/vip/dist/lib/cli/command.js:461:11)
Error:  Unexpected error
Debug:  VIP-CLI v3.8.4, Node v18.11.0, darwin 24.0.0 arm64

Ideally, it should have returned something like this instead:

┌──────────────────────┬───────┐
│ name                 │ value │
├──────────────────────┼───────┤
│ AWS_S3_KEY_ADDONS    │ null  │
├──────────────────────┼───────┤
│ AWS_S3_SECRET_ADDONS │ null  │
...

This PR achieves that.

Pull request checklist

New release checklist

Steps to Test

  1. Check out trunk.
  2. Apply this test.patch
  3. Run vip @97.production config envvar get-all
    Expected: error should appear
  4. Switch to this branch
  5. Run vip @97.production config envvar get-all
    Expected: should be rendered properly

Copy link
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Manifest Files

Copy link

sonarcloud bot commented Oct 16, 2024

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

Successfully merging this pull request may close these issues.

1 participant