title: Firebase: how to fix Error: ENOENT: no such file or directory, open 'node_modules/protobufjs/google/protobuf/api.proto'
body: <p>We are making the following query to cloud firestore:</p>
  
  <pre><code> ` var meeting = await db.collection("meetings").where(
      "pin", "==", request.body.Digits).where(
      "status", "==", "in-progress").get()`
  </code></pre>
  
  <p>This works on our local machines, but fails when we deploy to EC2. We have the Firestore client library installed on both, but we webpack it when we deploy. </p>
  
  <p>This error is particularly puzzling because the above snippet is wrapped in a try block, but the following error is thrown on that line without being caught:</p>
  
  <pre><code>UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open 'node_modules/protobufjs/google/protobuf/api.proto'
      at Object.openSync (fs.js:431:3)
      at Object.readFileSync (fs.js:333:35)
      at fetch (/home/node/server/app.compiled.js:350251:34)
      at Root.load (/home/node/server/app.compiled.js:350285:13)
      at Root.loadSync (/home/node/server/app.compiled.js:350326:17)
      at Object.loadSync (/home/node/server/app.compiled.js:347406:17)
      at Object../node_modules/@grpc/proto-loader/build/src/index.js (/home/node/server/app.compiled.js:65075:37)
      at __webpack_require__ (/home/node/server/app.compiled.js:20:30)
      at Object.&lt;anonymous&gt; (/home/node/server/app.compiled.js:222521:25)
      at Object../node_modules/google-gax/build/src/grpc.js (/home/node/server/app.compiled.js:222775:30)
      at __webpack_require__ (/home/node/server/app.compiled.js:20:30)
      at Object../node_modules/google-gax/build/src/index.js (/home/node/server/app.compiled.js:222819:16)
      at __webpack_require__ (/home/node/server/app.compiled.js:20:30)
      at Object.&lt;anonymous&gt; (/home/node/server/app.compiled.js:44631:13)
      at Object../node_modules/@google-cloud/firestore/build/src/v1/firestore_client.js (/home/node/server/app.compiled.js:45987:30)
      at __webpack_require__ (/home/node/server/app.compiled.js:20:30)
  (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
  </code></pre>
  
  <p>We have tried pretty much everything you could think of without actually changing the query- re-doing the package.json and our build scripts, but cannot figure this out. Any help?</p>