zsh: parse error near `\n' when Adding AWS keys as environment variables

You probably have some "special" characters in your Amazon access key or secret key which ZSH is interpreting. You usually need to "escape" these characters, but in this case you should be able to put the strings in quotes.

Try this instead (note the quotes around the values)

heroku config:add aws_access_key="<your access key>" aws_secret_key="<your secret key>"

Most likely your keys contain some characters that have special meaning to zsh.

Use single quotes (') around your keys:

heroku config:add aws_access_key='<your access key>' aws_secret_key='<your secret key>'

If there are any single quotes in your keys write '\'' instead. For example, instead of

aws_access_key=stevie's key

write

aws_access_key='stevie'\''s key'

Explanation: anything between a pair of single qoutes is taken exactly as it is written, there will be no parameter or command substitution or escape codes. As the second ' ends the quote any ' you want to write has to be quoted in anoter way outside of a pair of single quotes, either \' or "'".


I have the same error, and resolved it . because I type like this

$ heroku config:set AWS_SECRET_KEY=<A2D3F4H5A6D7HJ8KHF9>

then got the error. change like That:

$ heroku config:set AWS_SECRET_KEY=A2D3F4H5A6D7HJ8KHF9

success