0

I keep trying to run the command

env SSL=true DATABASE_URL=$(heroku config:get DATABASE_URL) npm run migrate

in git bash to migrate to my heroku database.

For some reason I keep on getting the error env: ‘config:get’: No such file or directory as a result, but I need to have SSL be true in order to avoid a "no pg_hba.conf entry" error.

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • What operating system are you using? I suspect you really just want to do `SSL=true DATABASE_URL=$(heroku config:get DATABASE_URL) npm run migrate`, omitting `env`. – ChrisGPT was on strike Jan 08 '21 at 00:21
  • Windows 10. I tried omitting env, but that caused "SSL" to become unrecognizable. – Zackry Broodie-Stewart Jan 08 '21 at 02:54
  • Ah, on Windows you'll need to use completely different syntax. I'll add an answer. – ChrisGPT was on strike Jan 08 '21 at 19:16
  • Oh, I misread earlier. You're trying to run this via Git bash... what does 'that caused "SSL" to become unrecognizable' mean? I think the last part of my answer will work for you, anyway. – ChrisGPT was on strike Jan 08 '21 at 19:29
  • I'm quite certain that you shouldn't be running `env` here. If you can [edit] your question to expand on what you mean by 'that caused "SSL" to become unrecognizable' we may still be able to help you. Alternatively, you should be able to simply run your migration on Heroku as I suggested at the end of my answer. – ChrisGPT was on strike Jan 11 '21 at 18:51

1 Answers1

0

The command you're trying to run appears to be designed for Linux-y shells, not Windows-y shells.

On PowerShell, try this:

PS C:\> $env:SSL = 'true'
PS C:\> $env:DATABASE_URL = heroku config:get DATABASE_URL
PS C:\> npm run migrate

If you're using cmd.exe, setting a variable from command output is pretty horrible. I'd probably just use PowerShell or manually copy the database string:

C:\> set SSL=true
C:\> heroku config:get DATABASE_URL
<copy database URL>
C:\> set DATABASE_URL <paste database URL>
C:\> npm run migrate

Better yet, consider running your migration right from Heroku:

heroku run npm run migrate
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257