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

Merged
merged 1 commit into from
Oct 24, 2024

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

@bor0 bor0 requested review from sjinks and aswasif007 October 16, 2024 14:22
@sjinks sjinks added the [Type] Bug Something isn't working label Oct 19, 2024
@bor0 bor0 merged commit df8de47 into trunk Oct 24, 2024
16 checks passed
@bor0 bor0 deleted the fix/reliable-string-conversion branch October 24, 2024 12:56
@bor0 bor0 self-assigned this Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vip @<app-id>.<env> config envvar get-all crashes when the logged in user doesn't have sufficient permissions
2 participants