Apparently the problem is not in the module, however when executing the next line of code now-dev returns this error
db.collection('cities').doc('LA').set(data);
now does not present this error when deploying the project, however, that line of code can not be executed either.

Step 1
Open the Firebase console and create a new project
In the Database section, click on Test Firestore
Click on enable
Click on Generate new private key
Step 2
Create new project mkdir example-test
Create an index.js file
yarn init -y
Add the following dependency to your project: yarn add firebase-admin
Step 3
Place the following code in the file index.js
const admin = require('firebase-admin');
const serviceAccount = require('./serviceAccountKey.json');
admin.initializeApp({
credential: admin.credential.cert(serviceAccount)
});
const db = admin.firestore();
const data =ย {
name: 'Mark',
lastName: 'Drew'
age: 21
}
db.collection('person').doc('Mark').set(data);
run the following command: DEBUG=*fun* ~/Downloads/now-macos dev --debug --port 8080
{
"name": "db-serverless",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"firebase-admin": "^7.0.0"
}
}
I haven't been able to find any direct replication of this, without creating a sample firebase account and database.
In my tests though, the grpc binary is being references by the asset locator fine (the root cause of the error above). I can't see how it could be calling the exports.find method at all since there are no calls to this in the firebase-admin build, just an empty reference to the bindings require which isn't touched otherwise.
It would help to know which version of ncc is being run here, and also to see the source of the build file to know what is calling that exports.find at user/index.js:99153.
@TooTallNate could you give us that information ?
@guybedford the version ncc is 0.15.2 ๐ธ
@MAPESO thanks, that is very odd indeed. Are you able to share the contents of user/index.js:99153 then? Running ncc build index.js && node dist manually in the project may be a way to get this.
@guybedford Hi, I regret the delay to answer just now, I was a bit busy yesterday.
The result of the code line 99153 is a firebase function
function FirebaseNamespace() {
// Hack to prevent Babel from modifying the object returned as the default admin namespace.
/* tslint:disable:variable-name */
this.__esModule = true;
/* tslint:enable:variable-name */
this.credential = firebaseCredential;
this.SDK_VERSION = '7.0.0';
/* tslint:disable */
// TODO(jwenger): Database is the only consumer of firebase.Promise. We should update it to use
// use the native Promise and then remove this.
this.Promise = Promise;
this.INTERNAL = new FirebaseNamespaceInternals(this);
}
we moved this error to #317
@MAPESO โ Is this error the same as the one in #317? #317 is fixed for me on now but now dev is throwing this error when trying to run a lambda that uses Firestore:
ncc: Module directory "/Users/<user>/Library/Caches/co.zeit.now/dev/workPaths/8689408615/user/node_modules/@firebase/database/dist" attempted to require "request" but could not be resolved, assuming external.
ncc: Module directory "/Users/<user>/Library/Caches/co.zeit.now/dev/workPaths/8689408615/user/node_modules/hash-stream-validation" attempted to require "fast-crc32c" but could not be resolved, assuming external.
ncc: Module directory "/Users/<user>/Library/Caches/co.zeit.now/dev/workPaths/8689408615/user/node_modules/write-file-atomic" attempted to require "worker_threads" but could not be resolved, assuming external.
ncc: Module directory "/Users/<user>/Library/Caches/co.zeit.now/dev/workPaths/8689408615/user/node_modules/retry-request" attempted to require "request" but could not be resolved, assuming external.
ncc: Module directory "/Users/<user>/Library/Caches/co.zeit.now/dev/workPaths/8689408615/user/node_modules/bytebuffer/dist" attempted to require "memcpy" but could not be resolved, assuming external.
/private/var/folders/qs/rgfhf56n7pddh_nzcb6ljllh0000gp/T/zeit-fun-48745d7f39e7f/user/packages/get-results/index.js:90558
throw error;
^
Error: package.json does not exist at /private/var/folders/qs/rgfhf56n7pddh_nzcb6ljllh0000gp/T/zeit-fun-48745d7f39e7f/user/packages/package.json
at Object.module.exports.exports.find (/private/var/folders/qs/rgfhf56n7pddh_nzcb6ljllh0000gp/T/zeit-fun-48745d7f39e7f/user/packages/get-results/index.js:130909:15)
at Object.module.exports.Object.defineProperty.value (/private/var/folders/qs/rgfhf56n7pddh_nzcb6ljllh0000gp/T/zeit-fun-48745d7f39e7f/user/packages/get-results/index.js:40938:12)
at __webpack_require__ (/private/var/folders/qs/rgfhf56n7pddh_nzcb6ljllh0000gp/T/zeit-fun-48745d7f39e7f/user/packages/get-results/index.js:22:30)
at Object.<anonymous> (/private/var/folders/qs/rgfhf56n7pddh_nzcb6ljllh0000gp/T/zeit-fun-48745d7f39e7f/user/packages/get-results/index.js:116053:12)
at __webpack_require__ (/private/var/folders/qs/rgfhf56n7pddh_nzcb6ljllh0000gp/T/zeit-fun-48745d7f39e7f/user/packages/get-results/index.js:22:30)
at Object.module.exports.module.exports.destroy (/private/var/folders/qs/rgfhf56n7pddh_nzcb6ljllh0000gp/T/zeit-fun-48745d7f39e7f/user/packages/get-results/index.js:144473:27)
at __webpack_require__ (/private/var/folders/qs/rgfhf56n7pddh_nzcb6ljllh0000gp/T/zeit-fun-48745d7f39e7f/user/packages/get-results/index.js:22:30)
at Object.module.exports.Object.defineProperty.value (/private/var/folders/qs/rgfhf56n7pddh_nzcb6ljllh0000gp/T/zeit-fun-48745d7f39e7f/user/packages/get-results/index.js:95564:14)
at __webpack_require__ (/private/var/folders/qs/rgfhf56n7pddh_nzcb6ljllh0000gp/T/zeit-fun-48745d7f39e7f/user/packages/get-results/index.js:22:30)
at Object.module.exports.MurmurHash3.hash.len (/private/var/folders/qs/rgfhf56n7pddh_nzcb6ljllh0000gp/T/zeit-fun-48745d7f39e7f/user/packages/get-results/index.js:112730:19)
LambdaError: RequestId: abde9b54-2575-4a05-90b0-c0b1ddf57bd5 Process exited before completing request
at Lambda.<anonymous> (/snapshot/repo/dist/index.js:1:1969499)
at Generator.next (<anonymous>)
at fulfilled (/snapshot/repo/dist/index.js:1:1967680)
at process._tickCallback (internal/process/next_tick.js:68:7)
@danoc We are investigating the cause of that problem. Thanks for reporting ๐
Thanks, @MAPESO! Your bug reports have all been very helpful.
Is there an open issue I can follow along in? Or should this one be opened?
@danoc I just created an issue in now cli. All research information will be concentrated in that place :D
Most helpful comment
@MAPESO โ Is this error the same as the one in #317? #317 is fixed for me on
nowbutnow devis throwing this error when trying to run a lambda that uses Firestore: