heroku-deploy
heroku-deploy copied to clipboard
Error: Command failed: heroku login
Hi, hope you're having a good weekend!
I am currently getting this error:
Created and wrote to ~/.netrc
› Warning: Our terms of service have changed:
› https://dashboard.heroku.com/terms-of-service
Error: Error: Command failed: heroku login
› Warning: Our terms of service have changed:
› https://dashboard.heroku.com/terms-of-service
› Error: Cannot log in with HEROKU_API_KEY set
› Error: Cannot log in with HEROKU_API_KEY set
I have double and tripple checked my heroku_api_key
, heroku_app_name
and heroku_email
and they are all correct. Was there a change to how the heroku api works recently?
Below is my config:
- name: Deploy Production
uses: akhileshns/[email protected] # This is the action
if: contains(github.ref, 'main')
with:
heroku_api_key: ${{ env.HEROKU_API_KEY }}
heroku_app_name: ${{ env.HEROKU_APP_NAME_PRODUCTION }}
heroku_email: ${{ env.HEROKU_EMAIL }}
healthcheck: ${{ env.HEROKU_HEALTH_CHECK_URL_PRODUCTION }}
checkstring: 'ok'
rollbackonhealthcheckfailed: true
It doesn't say anything about any new changes in the official documentation : https://devcenter.heroku.com/articles/authentication
Can you try running the following command to verify that the Heroku cli can read the API KEY
heroku auth:token
I'll continue looking into this. In the meantime, you can try checking the following resources if they are any help: https://stackoverflow.com/questions/61038002/heroku-cli-auth-by-token https://stackoverflow.com/questions/49823912/on-deploy-heroku-says-it-cant-find-api-key-even-though-ive-logged-in
@AkhileshNS running other commands manually is working just fine. Thank you for taking a look into it!
the message terms of service is always shown. i don't think that is the issue.
i noticed that when i was using the action with a brand new project, the action would fail because it first tried to fetch from the remote. Once i pushed to the remote one time manually, the action worked fine.
Hey @kylefritz, sorry for the late reply. I've never personally experienced that behavior but I'll try and recreate it all the same to try and diagnose. Do you by any chance have the logs for when something like that happens. That would be pretty helpful.
Also @cj, based on @kylefritz's experience could you try deploying once manually and then seeing the deployments continue to work after that via GitHub Actions
hey @AkhileshNS, here are the logs
Run akhileshns/[email protected]
Created and wrote to ~/.netrc
Successfully logged into heroku
› Warning: Our terms of service have changed:
› https://dashboard.heroku.com/terms-of-service
Added git remote heroku
heroku: Press any key to open up the browser to login or q to exit: fatal: couldn't find remote ref master
Unable to push branch because the branch is behind the deployed branch. Using --force to deploy branch.
(If you want to avoid this, set dontuseforce to 1 in with: of .github/workflows/action.yml.
Specifically, the error was: Error: Command failed: git fetch heroku master
fatal: couldn't find remote ref master
fatal: couldn't find remote ref master
Error: Error: Command failed: git fetch heroku master
fatal: couldn't find remote ref master
Line 7 in the log is missing a new line. if it had one, line 8 would start with fatal: couldn't find remote ref master
Hi! I have same error that @kylefritz! What do doing? :tired_face:
Based on the research I've done, this might have something to do with Git moving from the 'master' branch to 'main'.
On that note, could you try adding the following property to your action implementation
remote_branch: main
Based on the research I've done, this might have something to do with Git moving from the 'master' branch to 'main'.
On that note, could you try adding the following property to your action implementation
remote_branch: main
Excelent!
hey @cj and @kylefritz, based on the conversation I had with @engeldevelopment. I've concluded the problem is likely due to Git now switching from "master" to "main". I've updated the action to push to "main" by default (or you can push to master by just adding remote_branch: master
). Have a look at the documentation for more info. Let me know if this solves your problem and if it does please close this issue
Hi @AkhileshNS I am getting the same error but on main I have attached the logs. Your help would be appreciated. Thanks in advance.
We were getting the same error talked about initially as well. When I tried to update to the latest version, I get the same error as @KrishnanVC.
@KrishnanVC after adding remote_branch: master
to our Github Action, the deploy worked again.
@KrishnanVC after adding
remote_branch: master
to our Github Action, the deploy worked again.
Thanks for the reply😃. I tried that but it gives me the same error but with master instead of main
It seems like the new change is causing problems across the board. In some cases, it's master
over main
and in some other cases, it's the opposite. For now, if your deployment doesn't work by default please try and add remote_branch: master
to your action.
In the meantime, Heroku does offer the option to deploy using it's API instead of git. I'm going to try and set that up in the Action and that should hopefully fix the issue alltogether
Hey sorry for the delays in the recent update. But the latest release 3.11.10
fixes the "master" and "main" problem. Now the action pushes to "main" by default and if your Heroku App still uses the "master" branch, the Action will automatically switch your app to use "main" instead. This corresponds to Heroku officially declaring it's continued support for main and potential withdrawal from master.
Again sorry about the delay and also remote_branch
is no longer a property in the Action so I request that everyone who is using it please remove it
MY default branch is main
and I did set the API key correctly in the secrets environment of GitHub actions. But still getting:
Created and wrote to ~/.netrc
› Warning: Our terms of service have changed:
› https://dashboard.heroku.com/terms-of-service
▸ not logged in
Error: Error: Command failed: heroku container:login
› Warning: Our terms of service have changed:
› https://dashboard.heroku.com/terms-of-service
▸ not logged in
EDIT: well.. It's because you are not using the env:
statement when using the environment secret in the GH Actions Job actually. HEROKU_API_KEY as a repository secret is working, but keep in my this will leak your password/API key to /home/runner/.docker/config.json
file.