title: Gatsby + Netlify-Dev Lambda Functions - Lambda Server Port always different?
body: <p>I am trying to use <code>netlify-dev</code> and their serverless functions with my gatsby project.</p>
  
  <p>Here is my <code>netlify.toml</code> file</p>
  
  <pre><code>[build]
    functions = "lambda"
    command = "gatsby build"
  [dev]
    command = "gatsby develop"
    functionsPort = 34567
    port = 8000
    publish = "public"
    targetPort = 8000
  </code></pre>
  
  <p>I added this to my Gatsby Config </p>
  
  <pre><code>const proxy = require("http-proxy-middleware")
  module.exports = {
    developMiddleware: app =&gt; {
      app.use(
        "/.netlify/functions/",
        proxy({
          target: "http://localhost:34567",
          pathRewrite: {
            "/.netlify/functions/": "",
          },
        })
      )
    },
    //...
  </code></pre>
  
  <p>However, there seems to be something wrong with the port
  I always get a new random port, everytime I run <code>netlify dev</code></p>
  
  <pre><code>Netlify Dev ◈
  ◈ Injected build setting env var:  CLOUDINARY_CLOUD_NAME
  ◈ Injected build setting env var:  CLOUDINARY_API_KEY
  ◈ Injected build setting env var:  CLOUDINARY_SECRET
  ◈ Starting Netlify Dev with gatsby
  Waiting for localhost:8000.
  ◈ Lambda server is listening on 61271 //*** I would expect this to be 34567? ***
  success open and validate gatsby-configs - 0.066s
  ⠋ load plugins
  </code></pre>
  
  <p>What am I missing here? And why is the port always different?</p>