title: How to use Fixie Socks (Heroku add-on) to connect to mongodb via mongoose
body: <p>I have a node.js express api which I host on heroku. It connects to mongodb atlas via mongoose as follows</p>
  
  <pre><code>mongoose.connect(
  `mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PWD}@${process.env.MONGO_HOST}/${process.env.MONGO_DEFAULT_DB}?retryWrites=true`, {
    useNewUrlParser: true,
    autoReconnect: true,
    keepAlive: 300000,
    connectTimeoutMS: 300000,
    socketTimeoutMS: 300000
  }
  )
  .then(result =&gt; {
    console.log('Connected and listening to requests!');
    app.listen(process.env.PORT || 3000);
  .catch(err =&gt; console.log(err));
  </code></pre>
  
  <p>I want to use Atlas MongoDB Cloud's whitelist for the Heroku app, instead of opening access up to all. Heroku doesn't have fixed a IP address but makes them possible via an add-on called <a href="https://elements.heroku.com/addons/fixie-socks" rel="noreferrer">Fixie Socks</a>, which acts as a proxy for outbound traffic.</p>
  
  <p>How can I use this add-on to get the connection to work? <a href="https://devcenter.heroku.com/articles/fixie-socks" rel="noreferrer">The documentation</a> gives several examples on how to connect to other services and databases, but there is no help on mongodb. All examples use the FIXIE_SOCKS_HOST which contains the SOCKSV5 proxy URL, user, pass and port, but I'm at a loss on how to use it in conjunction with the mongoose.connect method. </p>
  
  <p>This question has been <a href="https://stackoverflow.com/questions/42229390/connecting-to-mongodb-using-mongoose-and-fixie-heroku-add-on">asked before</a>, but when a different add-on was used (Fixie vs Fixie Socks), which didn't work. </p>