title: NEXT.js + firebase hosting + firebase function + express application works on serve but not when deployed
body: <p>Following the example in Next.js repo <a href="https://github.com/zeit/next.js/tree/canary/examples/with-firebase-hosting" rel="nofollow noreferrer">with-firebase-hosting sample</a>.</p>
  
  <p>Here is my repo <a href="https://github.com/jojonarte/with-express-firebasehosting-next" rel="nofollow noreferrer">https://github.com/jojonarte/with-express-firebasehosting-next</a></p>
  
  <p>I'm trying to modify the functions server to use <code>express</code> for handling redirects.</p>
  
  <p>The app works properly when deploying it locally via <code>firebase serve</code> but <code>firebase deploy</code> doesn't work as intended.</p>
  
  <p>It actually deploys properly but whenever I open the deployed hosting link I get error below in <code>firebase console</code></p>
  
  <pre><code>TypeError: handler is not a function
      at cloudFunction (/srv/node_modules/firebase-functions/lib/providers/https.js:57:9)
      at /worker/worker.js:783:7
      at /worker/worker.js:766:11
      at _combinedTickCallback (internal/process/next_tick.js:132:7)
      at process._tickDomainCallback (internal/process/next_tick.js:219:9)
  </code></pre>