You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to run a release script to copy a database from a staging environment to a review app.
# In release script...
heroku config:set HEROKU_API_KEY=`heroku auth:token`
heroku pg:copy stage-app-name::$DATABASE_URL $DATABASE_URL -a $HEROKU_APP_NAME --confirm $HEROKU_APP_NAME
But I get authentication errors.
› Error: not logged in
› Error: Missing required flag:
› -a, --app APP app to run command against
› See more help with --help
▸ Invalid credentials provided.
heroku: Press any key to open up the browser to login or q to exit: ▸ Invalid credentials provided.
Enter your Heroku credentials:
Email:
So, I'm trying to figure out how to login the best way in a review app environment in order to use the CLI commands during the release phase. Is the recommended way to use a permanemtn machine user? Or to do it in a more ephemeral way each release?
I think I can add a user, store creds in environmental variables, and then use those to login, but I'm not sure of the best option. I figure plenty of other people want to do this or have accomplished it already.
The text was updated successfully, but these errors were encountered:
After spending more time on this than I'm willing to admit I eventually got it working by directly setting HEROKU_API_KEY under my pipeline settings (see attached)
On your local terminal (assuming you have already logged into the CLI app with your username/password) run: heroku authorizations:create --short this will create a long-lived token you can use to set HEROKU_API_KEY
You'll also want to wrap your command inside of heroku run e.g. heroku run "heroku pg:copy stage-app-name::$DATABASE_URL $DATABASE_URL -a $HEROKU_APP_NAME --confirm $HEROKU_APP_NAME" -a $HEROKU_APP_NAME
Thanks @rlueder for the explanation. I can also say I ended up using this method of directly setting HEROKU_API_KEY config var in the pipeline settings and it just works.
This is kind of documentation...and good enough for people searching for the answer, but I am too busy now to formally add to docs. So, whoever monitors these issues can close this one if no one has time to add to docs. I no longer have this issue.
I'm trying to run a release script to copy a database from a staging environment to a review app.
But I get authentication errors.
So, I'm trying to figure out how to login the best way in a review app environment in order to use the CLI commands during the release phase. Is the recommended way to use a permanemtn machine user? Or to do it in a more ephemeral way each release?
I think I can add a user, store creds in environmental variables, and then use those to login, but I'm not sure of the best option. I figure plenty of other people want to do this or have accomplished it already.
The text was updated successfully, but these errors were encountered: