Installing an ssl certificate in Heroku: Resolving trust chain… failed ! No certificate given.

I was installing a certificate in Heroku for my app, and when running the command:

heroku certs:add server.crt bundle.pem server.key --app myappname-production

I got this error message:

Resolving trust chain... failed !
No certificate given.

I got desperate until I read carefully, that the certificates, all of them:

server.crt
bundle.pem
server.key

have to include the first and last line:

first line:
—–BEGIN CERTIFICATE—–

end line:
—–END CERTIFICATE—–

If you do not copy those lines into the file (I received the certs via email, this is why I have to manually copy/paste, except for server.key that I generate from command line).

Hope it is a useful hint for you!!