Parse error near `&' while setting Heroku config vars - heroku

I am setting my Heroku config variable through terminal, and get this error:
zsh: parse error near `&'
my zsh version is 5.7.1 platform: Mac Mojave
Here is the command I'm running:
heroku config:set vidly_db=mongodb://vidlyuser:mypassword#vidly-shard-00-00-yyjmw.mongodb.net:27017,vidly-shard-00-01-yyjmw.mongodb.net:27017,vidly-shard-00-02-yyjmw.mongodb.net:27017/test?ssl=true&replicaSet=vidly-shard-0&authSource=admin&retryWrites=true

& is a special character in Zsh (and Bash, and most other Unixy shells)¹. Wrap your value in quotes:
heroku config:set vidly_db='mongodb://vidlyuser:mypassword#vidly-shard-00-00-yyjmw.mongodb.net:27017,vidly-shard-00-01-yyjmw.mongodb.net:27017,vidly-shard-00-02-yyjmw.mongodb.net:27017/test?ssl=true&replicaSet=vidly-shard-0&authSource=admin&retryWrites=true'
¹For example, it's used for backgrounding jobs.

Related

_heroku:2: HEROKU_AC_ANALYTICS_DIR: parameter not set

I installed heroku cli via snap (sudo snap install heroku --classic), but the autocomplete does not work throws an error: _heroku:2: HEROKU_AC_ANALYTICS_DIR: parameter not set, never encountered this before, who knows what could be the problem?
i`m using the zsh command shell
Try this solution:
https://devcenter.heroku.com/articles/heroku-cli-autocomplete
heroku update
heroku autocomplete
Worked for me.
UPD:
Run the following after commands above (heroku asks to do this after running them anyways):
printf "$(heroku autocomplete:script zsh)" >> ~/.zshrc; source ~/.zshrc

Installed Heroku but not recognised

I installed git and Heroku on my Windows8.1 64bit machine. On running:heroku --version I get the following error:
bash: heroku: command not found
What must I do to enable it?
Installing Heroku Toolbelt on Windows 10
bash: heroku: command not found
The error message is clear: Bash cannot find the heroku command, it's not on your PATH.
I checked, and the Heroku folder was added to the PATH.
It seems you didn't check it correctly.
Note that even if it looks correct in the PATH settings window,
Git Bash might have a different PATH configured.
To see the PATH in Git Bash, run:
echo $PATH
When debugging path issues,
it's best to first run heroku with the absolute path. For example if it's in C:\Program Files\Heroku\bin\heroku then you can run in Git Bash with:
/c/Program\ Files/Heroku/bin/heroku login
If this works (and it should),
then you can add it to PATH like this:
PATH="$PATH:/c/Program\ Files/Heroku/bin"
Note that Heroku will likely need other programs too on the PATH,
such as MySQL and Ruby.
Find their absolute paths,
and add there directories to PATH the same way as heroku itself in the above example.
If instead of Git Bash,
you want to work in CMD,
the procedure is the same,
but the syntax to print and set PATH is different:
echo %PATH%
set PATH="C:\Program Files\Heroku\bin;%PATH%"

Heroku CLI commands 'pico' not recognized on Windows 10?

I am using the Heroku CLI in order to edit my MySQL ClearDB Server on it. Whenever I carry out the command
heroku config:edit --app myApplication
I get an error referencing ‘pico’ command.
This is what it is in it’s entirety:
Fetching config... done
Waiting for pico... 'pico' is not recognized as an internal or external command,
operable program or batch file.
Error: spawn pico ENOENT
at notFoundError (C:/Program Files/heroku/client/node_modules/cross-spawn/lib/enoent.js:6:26)
at verifyENOENT (C:/Program Files/heroku/client/node_modules/cross-spawn/lib/enoent.js:40:16)
at ChildProcess.cp.emit (C:/Program Files/heroku/client/node_modules/cross-spawn/lib/enoent.js:27:25)
Since I am using Windows 10, I can't directly obtain 'pico' which is for Unix systems. Don't know if there's a way around this, perhaps there is some alternative command prompt simulator I could use although don’t wanna go that route; or more favorably method of making it work by changing the default text editor for the CLI?
Doesn't fix the 'pico' problem but
heroku config --json --app my_app
will list your config variables to the terminal. These can then be modified using the
heroku config:set config_Key=config_Value --app my_app

Windows bash 'Cannot create property 'exitCode' on string 'autoupdate:' Installing Heroku CLI/Toolbelt

I am attempting to install the Heroku CLI/Toolbelt on an bash shell version 4.3.48(1) (x86_64-pc-linux-gnu) running on Windows 10. I'm entering wget -qO- https://cli-assets.heroku.com/install-ubuntu.sh | sh in the command line, and after the packages download I'm getting the below:
Preparing to unpack .../heroku_6.14.24-1_amd64.deb ...
Unpacking heroku (6.14.24-1) ...
Setting up heroku (6.14.24-1) ...
+ which heroku
+ LOCATION=/usr/bin/heroku
+ echo heroku cli installed to /usr/bin/heroku
heroku cli installed to /usr/bin/heroku
+ heroku version
▸ Cannot create property 'exitCode' on string 'autoupdate:'
And then it just takes me back to the command line. If I try heroku --v or any other heroku CLI command I get this same error
▸ Cannot create property 'exitCode' on string 'autoupdate:'
I can't find any record of this error code anywhere online. Any thoughts? I really do not know where to start here, usually a good search at least sets me on the path but I have crickets here. Let me know if any further details are required. FWIW the toolbelt was working as of a few days ago, I just had to uninstall and reinstall my bash shell due to an unfortunate incident with Linuxbrew so am rebuilding everything from scratch.
this is fixed but the CLI might have trouble updating. Delete ~/.local/share/heroku and run heroku update and it should be fixed.

Heroku toolbelt on windows config:add causes broken paths

Attempting to set LD_LIBRARY_PATH on my heroku rails app using the heroku toolbelt on windows wrongly substitutes the paths sent to the app.
Running the following using heroku toolbelt on windows:
heroku config:add LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib:/app/vendor/phantomjs/lib
Setting config vars and restarting... done, v164
LD_LIBRARY_PATH: C:\dev\Git\local\lib;C:\dev\Git\lib;C:\dev\Git\lib;C:\dev\Git\app\vendor\phantomjs\lib
It seems the toolbelt is automatically replacing "/usr" with "C:\dev\Git\" (where msysgit is installed on my system). Obviously this breaks my heroku app because these paths do not make sense on the server.
This is actually not a problem with Heroku toolbelt, it's documented behavior by msys (I'm assuming you're running this in msysgit). You can either run the command in a different shell (eg. Powershell) or use '//' at the start of the path like this:
heroku config:add LD_LIBRARY_PATH=//usr/local/lib://usr/lib:/lib://app/vendor/phantomjs/lib
This won't cause problems when the path is used on Linux.

Resources