Skip to content

fix(cli): Fixes bug with command 'ps -x' (sudo) - #3051

Merged
sbosio merged 1 commit into
mainfrom
sbosio/fix-ps-x
Oct 23, 2024
Merged

fix(cli): Fixes bug with command 'ps -x' (sudo)#3051
sbosio merged 1 commit into
mainfrom
sbosio/fix-ps-x

Conversation

@sbosio

@sbosio sbosio commented Oct 22, 2024

Copy link
Copy Markdown
Contributor

Description

The command

heroku sudo ps -x -a <private-space-app>

fails currently for Private Space apps because the extended property on the JSON response has many of its properties set to null, giving a TypeError when trying to coerce the null port number to a string.

Here we correct the type definition, allowing for null values on all of the extended properties and handling that case appropriately when building the output table display.

SOC2 Compliance

Slack thread for reference
GUS Work Item

@sbosio
sbosio requested a review from a team as a code owner October 22, 2024 15:02

@eablack eablack left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I'm still seeing an error when i try to run this with your branch:

Screenshot 2024-10-22 at 1 57 48 PM

is it possible we need to add another optional chain here? https://github.com/heroku/cli/pull/3051/files#diff-5d43d9c03ed768f9c4f93c44502238c8961bba579421ce39c334cbdfe20b1f0eR65

@sbosio

sbosio commented Oct 23, 2024

Copy link
Copy Markdown
Contributor Author

Hmm, I'm still seeing an error when i try to run this with your branch:

Screenshot 2024-10-22 at 1 57 48 PM is it possible we need to add another optional chain here? https://github.com//pull/3051/files#diff-5d43d9c03ed768f9c4f93c44502238c8961bba579421ce39c334cbdfe20b1f0eR65

No, the problem is sudo that will parse arguments and build a command again with the right headers, but using heroku and not ./bin/run, thus effectively using the unpatched version of the ps -x command.

Run tests with:

HEROKU_HEADERS='{"x-heroku-sudo": true}' ./bin/run ps -x -a particleboard-staging

It will require a few times for your 2FA method, but ultimately it will work.

@sbosio
sbosio requested a review from eablack October 23, 2024 14:11

@eablack eablack left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@sbosio
sbosio merged commit eeef085 into main Oct 23, 2024
@sbosio
sbosio deleted the sbosio/fix-ps-x branch October 23, 2024 16:56
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.

2 participants