title: How do I transfer production database to staging on Heroku using pgbackups? Getting error
body: <p>On Heroku, I am trying to copy the production database into my staging app using the pgbackups addon. I followed the instructions on the addon page: <a href="https://devcenter.heroku.com/articles/pgbackups">https://devcenter.heroku.com/articles/pgbackups</a></p>
  
  <p>First I captured the DB:</p>
  
  <pre><code>heroku pgbackups:capture --app production-app 
  </code></pre>
  
  <p>That worked:</p>
  
  <pre><code>HEROKU_POSTGRESQL_PURPLE (DATABASE_URL)  ----backup---&gt;  b238
  
  Capturing... done
  Storing... done
  </code></pre>
  
  <p>However when I try to restore it on the staging app:</p>
  
  <pre><code>heroku pgbackups:restore DATABASE `heroku pgbackups:url --app production-app` --remote staging
  </code></pre>
  
  <p>I get the following error message:</p>
  
  <pre><code>DATABASE_URL does not match any of your databases
   !    Could not resolve database DATABASE
   !    
   !    Available databases: 
  </code></pre>
  
  <p>I have also tried typing in the full URL:</p>
  
  <pre><code> heroku pgbackups:url b238 --app production-app
   heroku pgbackups:restore DATABASE "https://s3.amazonaws.com/..." --remote staging
  </code></pre>
  
  <p>and also tried naming the app (instead of --remote staging):</p>
  
  <pre><code>heroku pgbackups:restore DATABASE `heroku pgbackups:url --app production-app` --app staging-app
  </code></pre>
  
  <p>None of these worked. It's interesting to note that the error message says there are no "Available databases". I'm assuming it is referring to the staging app which is indeed empty. If I type:</p>
  
  <pre><code>heroku pgbackups
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code> !    No backups. Capture one with `heroku pgbackups:capture`.
  </code></pre>
  
  <p>To find the available backups (production), I need to type:</p>
  
  <pre><code>heroku pgbackups --app production-app
  </code></pre>
  
  <p>and I get the list of current backups. I don't know if this is normal or even if it is related to the problem, but I thought I should mention it. </p>
  
  <p>I have read and tried every answer here on SO but nothing worked. Any ideas?</p>