cli icon indicating copy to clipboard operation
cli copied to clipboard

Command parsing error when using heroku run with exit code flag -x

Open liamgarrison opened this issue 4 years ago • 11 comments

This project is for the Heroku CLI only. Use https://help.heroku.com for anything that is not specific to the CLI itself.

Do you want to request a feature or report a bug?

Bug report

What is the current behavior?

When I run heroku run with the -x flag, it gives a command parsing error irrespective of the command that is used or the app that it is being run on.

Example from my terminal:

❯ heroku run -x echo hello world! -a test-app
Running echo hello world! on ⬢ test-app... up, run.5122 (Hobby)
command parsing error%

What is the expected behavior?

It should return a zero exit code for the above command, and return the exit code of the specified command when I'm running arbitrary commands.

Heroku version:

❯ heroku --version
heroku/7.42.11 darwin-x64 node-v12.16.2

OS version: Mac OSX 10.15.5

No HTTP proxies or firewalls.

liamgarrison avatar Aug 26 '20 10:08 liamgarrison

Unable to reproduce this. Can you upgrade the CLI and try running the command on another app as well to see if we can't isolate the issue?

RasPhilCo avatar Sep 04 '20 12:09 RasPhilCo

Have upgraded the CLI, and tried on linux:

❯ heroku --version
heroku/7.44.0 linux-x64 node-v12.16.2

On a different app, it still give the same command parsing error.

Can you share an example command of it working, to make sure I've got the syntax right?

liamgarrison avatar Oct 07 '20 10:10 liamgarrison

I've just tried running in Gitlab CI too:

$ heroku run -x /bin/bash -c 'exit 1' -a test-app
Running /bin/bash -c "exit 1" on test-app...
 starting, run.1580 (Hobby)
Running /bin/bash -c "exit 1" on test-app... connecting, run.1580 (Hobby)
Running /bin/bash -c "exit 1" on test-app... up, run.1580 (Hobby)
command parsing error
ERROR: Job failed: command terminated with exit code 1

liamgarrison avatar Oct 07 '20 11:10 liamgarrison

The bug appears to be only for heroku apps running docker containers. When I set up a normal app without using containers, it runs fine. I think the command parsing error must be on the heroku platform API side of things?

liamgarrison avatar Oct 07 '20 11:10 liamgarrison

This looks related to https://github.com/heroku/cli/pull/930, which has more information on the problem. I'm also seeing this "parsing error" because my containers don't use a shell as the entry point.

bbc2 avatar Oct 13 '20 13:10 bbc2

Actually this doesn't seem to be related to a particular entry point. I can't really manage to make it work at all with containers.

bbc2 avatar Oct 13 '20 14:10 bbc2

Thanks for looking into it. It's quite an issue for us, as we run database migrations from Gitlab CI after deploying and if they fail we never know about it because all the jobs succeed because they are not receiving the exit code from the heroku dyno. Anyone on the heroku team able to look into it? Thanks.

liamgarrison avatar Oct 14 '20 13:10 liamgarrison

me too, when deploying using containers

matti avatar Apr 26 '21 13:04 matti

This is an issue for me too!

nicholasmordecai avatar May 06 '21 15:05 nicholasmordecai

yes same issue here deploying on containers

clemsos avatar Sep 09 '21 14:09 clemsos

We are seeing this same issue as described. App is running as a container, it doesn't matter which command is run. Using heroku/7.60.2 darwin-x64 node-v14.19.0 on OSX locally at the moment.

coryjoist avatar May 12 '22 21:05 coryjoist