-
Notifications
You must be signed in to change notification settings - Fork 157
Description
Hello!
During an attempt to bundle (via esbuild) a Node application using the firebase-admin
SDK I noticed that protos.json
is loaded using a require
call in a browser environment, but loaded differently in a Node environment, c.f.
require('../../protos/protos.json') |
While I acknowledge that bundling Node applications may not be a use-case you want to support, I was wondering why you made the explicit choice of not using require
in a Node environment? My suggestion would be to use require
in all environments, like so:
this._protos = this._gaxGrpc.loadProto(require('../../protos/protos.json'));
It'd appear that I am not the only one who ran into this issue:
- Functions fail when using Firebase Admin SDK netlify/next-on-netlify#68
- Firebase-Admin does not deploy properly to Lambda serverless-nextjs/serverless-next.js#876
Bundling back-end applications has some benefits (in my case, generate the smallest possible package for services deployed to Cloud Run / Cloud Functions), so if making this small change would enable it it'd be wonderful!
Thanks for your work.
Related threads: