title: Play 2.0 Scala Heroku instance isn't seeing every variable in the Procfile
body: <p>I'm using Play! 2.0 Scala edition on Heroku. Heroku does not seem to see/use all my configuration variables in the Procfile.</p>
  
  <p>For instance, in my application.conf I have the following variables (amongst others):</p>
  
  <pre><code>mongodb.default.db = "nyancat"
  mongodb.default.host = "localhost"
  mongodb.default.port = 27017
  </code></pre>
  
  <p>These should be the defaults for local development. However, I want my Heroku instance to use a MongoLabs instance. (Unfortunately, Salat doesn't configure with a URI, so I had to break it down into host, port, yada yada, i.e. MONGOLAB_URI isn't used)</p>
  
  <p>My Procfile now looks like this:</p>
  
  <pre><code>☆  cat Procfile                                             
  web: target/start -Dsecurehostname="https://example.org" \
  -Dhostname="http://example.org" -Dhttp.port=$PORT \
  -DapplyEvolutions.default=true -Ddb.default.driver=org.postgresql.Driver \
  -Ddb.default.url=$DATABASE_URL -Dredis=$REDISTOGO_URL \
  -Dmailgun.apikey=$MAILGUN_API_KEY -Dmongodb.default.db="heroku_appXXXXXXX" \
  -Dmongodb.default.host="dsXXXXXX.mongolab.com" -Dmongodb.default.port=XXXXX \
  -Dmongodb.default.user="heroku_appXXXXXXX" \
  -Dmongodb.default.password="foobared_not"
  </code></pre>
  
  <p>I push and restart, but the remote MongoDB connection still says it connects on localhost:27017</p>
  
  <p>Redis and everything else works fine and dandy.</p>
  
  <p>The remote log shows this when starting up, and it clearly doesn't contain all the parameters in my Procfile:</p>
  
  <pre><code>2012-05-20T19:35:18+00:00 heroku[web.1]: Starting process with command \
  `target/start -Dhostname="https://example.org" -Dhttp.port=XXXXX \
  -DapplyEvolutions.default=true -Ddb.default.driver=org.postgresql.Driver \
  -Ddb.default.url=&lt;HIDDEN&gt; -Dredis=&lt;HIDDEN&gt; -Dmailgun.apikey=&lt;HIDDEN&gt;`
  </code></pre>
  
  <p>I.e. no <code>mongo.*</code> parameters anywhere in the logs.</p>
  
  <p>Please let me know if I'm missing anything, thanks fellas.</p>
  
  <hr>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I tried to emulate Heroku locally, using <code>sbt stage</code> and running the app with <code>foreman start</code>. I set the environment variables which <em>would</em> be set by Heroku, and run it like this:</p>
  
  <pre><code>app git:(master) ☆  DATABASE_URL="jdbc:h2:mem:mydatabase;MODE=PostgreSQL" \
    REDISTOGO_URL="redis://ignored:foobared@localhost:6379/" \
    foreman start
  20:20:27 web.1     | started with pid 43382
  20:20:27 web.1     | Play server process ID is 43382
  20:20:29 web.1     | [info] play - database [default] connected at jdbc:h2:mem:mydatabase
  20:20:29 web.1     | [info] play - mongodb [default] connected at "heroku_appXXXXXXX"@"dsXXXXXX.mongolab.com":XXXXX/"heroku_appXXXXXXX"
  20:20:30 web.1     | [info] play - Application started (Prod)
  20:20:30 web.1     | [info] play - Listening for HTTP on port 5000...
  </code></pre>
  
  <p>foreman picks up my PRODUCTION MongoDB values as it is in the Procfile, which validates my argument that Heroku is perhaps using an older version of my Procfile for some unknown reason.</p>
  
  <p>On my Heroku instance, the Procfile is definitely does not have the immutable flag set either:</p>
  
  <pre><code>~ $ lsattr Procfile
  ------------------- Procfile
  </code></pre>
  
  <hr>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>I'm using <a href="https://github.com/leon/play-salat" rel="nofollow">MongoDB Salat plugin for Play Framework 2 (Scala only)</a>.</p>
  
  <p>Here's a pattern I picked up:</p>
  
  <p>Every push <strong>succeeded</strong> before I started implementing MongoDB support.</p>
  
  <p>Then I integrated the <a href="https://github.com/leon/play-salat" rel="nofollow">Salat plugin</a>, signed up for a MongoLabs account, and the fun started. The plugin above doesn't support <a href="http://api.mongodb.org/java/2.7.2/com/mongodb/MongoURI.html" rel="nofollow">com.mongodb.MongoURI</a> and due to the way it parses configuration, it will blow up if you give it <code>-Dmongodb.uri</code>. It expects a keyspace, like "default".</p>
  
  <p>Which brings us back to the <code>mongodb.default.*</code> switches I've been using above.</p>
  
  <p>Now my development cycle looks like this:</p>
  
  <pre><code>push, fail
  push (without changes), success, but seemingly with old Procfile
  &lt;make change&gt;
  push, fail
  push (without changes), success, but seemingly with old Procfile
  &lt;make change&gt;
  push, fail
  push (without changes), success, but seemingly with old Procfile
  ...
  </code></pre>
  
  <p>And most annoyingly, the failing push just logs this:</p>
  
  <pre><code>Heroku push rejected due to an unrecognized error.
  </code></pre>
  
  <p>...and the <code>heroku logs -t</code> output only show this:</p>
  
  <pre><code>2012-05-22T07:23:59+00:00 heroku[slugc]: Slug compilation failed: unrecognized error
  </code></pre>
  
  <p>It works locally, BTW.</p>
  
  <p>I've brought all this so Heroku support's attention since it could be that they swallow errors thrown by <a href="https://github.com/typesafehub/config" rel="nofollow">Typesafe's Config</a> when it could just make things clearer from the start.</p>
  
  <p>I've also asked them not to allow those second pushes to succeed, but then use an old Procfile. Very misleading.</p>
  
  <p>Needless to say, I'm now also implementing MongoURI support for the Salat plugin. </p>
  
  <hr>
  
  <p><strong>UPDATE 3</strong></p>
  
  <p><a href="https://github.com/leon/play-salat/pull/8" rel="nofollow">I've implemented support</a> for <code>mongodb.default.uri</code> in the Play! Salat plugin (and deployed it using lib/), but Heroku still throws an error whenever I push anything mongo-related in my Procfile.</p>
  
  <p>I've asked Heroku support the same question, and perhaps someone here can answer: does Heroku limit the variables you can use in Procfile?</p>