I'm seeing some dependency issues.
firebase-admin: 5.2.1
β customer-manager (master) β yarn add firebase-admin .../customer-manager
yarn add v0.27.5
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 2 new dependencies.
ββ @google-cloud/[email protected]
ββ [email protected]
Done in 4.74s.
β customer-manager (master) β yarn start .../customer-manager
yarn start v0.27.5
$ node build/dev-server.js
> Starting dev server...
ERROR Failed to compile with 22 errors 10:37:27 PM
These dependencies were not found:
* fs in ./~/firebase-admin/lib/auth/credential.js, ./~/@google-cloud/storage/src/bucket.js and 10 others
* net in ./~/faye-websocket/lib/faye/websocket/client.js, ./~/forever-agent/index.js and 3 others
* tls in ./~/faye-websocket/lib/faye/websocket/client.js, ./~/forever-agent/index.js and 1 other
* child_process in ./~/google-auth-library/lib/auth/googleauth.js
* dns in ./~/isemail/lib/isemail.js
Are those dependencies in fact installed? Is ./~/.../ the right path when referenced from build/dev-server.js? What does the yarn config file look like? There's a lot more to include here before we can help with debugging.
This was on a brand new repo. Should I have to install dependencies by hand? That doesn't seem right.
Are you trying to use firebase-admin in a client-side or browser environment? That is not supported. Some of the missing modules (fs, net etc.) are only available in server-side Node.js environments.
I installed firebase-admin on a brand new project which running webpack4 + typescript, getting these dependencies issue as well.
WARNING in ./node_modules/grpc/node_modules/node-pre-gyp/lib/util/versioning.js
16:20-67 Critical dependency: the request of a dependency is an expression
@ ./node_modules/grpc/node_modules/node-pre-gyp/lib/util/versioning.js
@ ./node_modules/grpc/node_modules/node-pre-gyp/lib/pre-binding.js
@ ./node_modules/grpc/src/grpc_extension.js
@ ./node_modules/grpc/index.js
@ ./node_modules/@google-cloud/common-grpc/src/index.js
@ ./node_modules/@google-cloud/firestore/src/index.js
@ ./src/index.ts
WARNING in ./node_modules/grpc/node_modules/node-pre-gyp/lib/pre-binding.js
19:22-48 Critical dependency: the request of a dependency is an expression
@ ./node_modules/grpc/node_modules/node-pre-gyp/lib/pre-binding.js
@ ./node_modules/grpc/src/grpc_extension.js
@ ./node_modules/grpc/index.js
@ ./node_modules/@google-cloud/common-grpc/src/index.js
@ ./node_modules/@google-cloud/firestore/src/index.js
@ ./src/index.ts
WARNING in ./node_modules/grpc/src/grpc_extension.js
32:12-33 Critical dependency: the request of a dependency is an expression
@ ./node_modules/grpc/src/grpc_extension.js
@ ./node_modules/grpc/index.js
@ ./node_modules/@google-cloud/common-grpc/src/index.js
@ ./node_modules/@google-cloud/firestore/src/index.js
@ ./src/index.ts
WARNING in ./node_modules/bytebuffer/dist/bytebuffer-node.js
Module not found: Error: Can't resolve 'memcpy' in '/Users/crossrt/www/malaysia-election/node_modules/bytebuffer/dist'
@ ./node_modules/bytebuffer/dist/bytebuffer-node.js 29:38-55
@ ./node_modules/protobufjs/dist/protobuf.js
@ ./node_modules/grpc/index.js
@ ./node_modules/@google-cloud/common-grpc/src/index.js
@ ./node_modules/@google-cloud/firestore/src/index.js
@ ./src/index.ts
Any idea how could these happened?
@crossRT did you found any solutions? I try to use firebase-admin with Netlify functions and get similar errors.
@ixjakub sorry for late reply.
No, I didn't find any solution eventually.
But I drop the use of typescript, and then it works like charm.
Hi, did you find any solutions? I have the same issue.
Had a similar issue, removed node_modules and reinstalled and it worked.
Thanks for your help, it didn't work. It shows:
Module not found: Error: Can't resolve 'fast-crc32c' in 'C:\Users\xxxxxxx\Desktop\Development\nuxt\project4\node_modules\hash-stream-validation'
ERROR Failed to compile with 43 errors 12:22:22
These dependencies were not found:
Why is this issue closed? I got the same problem with this dependency
"firebase": "^5.5.3",
"firebase-admin": "^6.5.0",
You Γ‘re using the same library at front-end and it is nota possible.
Firebase is used at front-end
Firebase-admin is used at back-end
I installed firebase-admin at back-end and it worked.
@ixjakub Did you find a solution ? I have the same pb running firebase-admin with netlify functions
I finally turned away from Firebase at all. I can't help you.
@hiranya911 Any update on this issue? Facing the same error.
There's no resolution. If your runtime complains about missing dependencies like fs, net and child_process, then that's a good indication that the Admin SDK should not be used in that environment.
@hiranya911 @aaaguirrep This is not an issue with running in a browser. For me this is using TypeScript/Node deploying to backend AWS Lambdas. This is the same thing Netlify is doing.
To be clear, I am running a BACKEND Serverless project using the serverless-webpack plugin, developed with TypeScript, transpiled to JS by web pack, and deployed to AWS Lambda through the Serverless project. All was working well until I tried to pull in some of these odd Google Cloud SDK modules, and now I cannot run my services at all.
FYI: Serverless-webpack is something I am seeing more and more of in 2019.
The error message is complaining about built-in Node packages like fs and net:
* fs in ./~/firebase-admin/lib/auth/credential.js, ./~/@google-cloud/storage/src/bucket.js and 10 others
* net in ./~/faye-websocket/lib/faye/websocket/client.js, ./~/forever-agent/index.js and 3 others
* tls in ./~/faye-websocket/lib/faye/websocket/client.js, ./~/forever-agent/index.js and 1 other
* child_process in ./~/google-auth-library/lib/auth/googleauth.js
* dns in ./~/isemail/lib/isemail.js
We don't declare them explicitly, but expect the Node.js environment to provide them. I don't know how to "fix" firebase-admin so it can resolve these built-ins. If anybody knows of a fix, or provide some pointers I'd be happy to take a look.
The solution to this problem most likely exists in the webpack domain. According to Google search there are many similar issues reported agains various other libraries, with no specific resolution in sight. But the following issue discusses several potential fixes, that seem to have fixed a similar issue to some: https://github.com/mysqljs/mysql/issues/1563
After installed "firebase-admin": "^8.3.0" it gives an error While trying to resolve module `fs . any help really appreciated.
Having the same issue, Why it looks closed ? @esparkman
Having the same issue when running netlify-lambda and a TypeScript function:
WARNING in node_modules/hash-stream-validation/index.js
Module not found: Error: Can't resolve 'fast-crc32c' in 'node_modules/hash-stream-validation'
@ node_modules/hash-stream-validation/index.js
@ node_modules/@google-cloud/storage/build/src/file.js
@ node_modules/@google-cloud/storage/build/src/index.js
@ node_modules/firebase-admin/lib/storage/storage.js
@ node_modules/firebase-admin/lib/firebase-namespace.js
@ node_modules/firebase-admin/lib/default-namespace.js
@ node_modules/firebase-admin/lib/index.js
@ ./supervisor.ts
WARNING in node_modules/configstore/node_modules/write-file-atomic/index.js
Module not found: Error: Can't resolve 'worker_threads' in 'node_modules/configstore/node_modules/write-file-atomic'
@ node_modules/configstore/node_modules/write-file-atomic/index.js
@ node_modules/configstore/index.js
@ node_modules/gcs-resumable-upload/build/src/index.js
@ node_modules/@google-cloud/storage/build/src/file.js
@ node_modules/@google-cloud/storage/build/src/index.js
@ node_modules/firebase-admin/lib/storage/storage.js
@ node_modules/firebase-admin/lib/firebase-namespace.js
@ node_modules/firebase-admin/lib/default-namespace.js
@ node_modules/firebase-admin/lib/index.js
@ ./supervisor.ts
Any clue?
Firebase ecosystem is such a mess. They don't give a shit about webpack use cases, because they want you to use Google Cloud Functions...
The following line in webpack.config.js solves the problem to me btw:
module.exports = {
...
externals: [ 'aws-sdk', 'commonjs2 firebase-admin' ],
...
};
The following line in
webpack.config.jssolves the problem to me btw:module.exports = { ... externals: [ 'aws-sdk', 'commonjs2 firebase-admin' ], ... };
Hi! Did you found any issue using this or is production safe?
The following line in
webpack.config.jssolves the problem to me btw:module.exports = { ... externals: [ 'aws-sdk', 'commonjs2 firebase-admin' ], ... };Hi! Did you found any issue using this or is production safe?
Not at all. It's working perfectly in production right now.
In my project i used the npm package: "firebase-admin" for accessing the firestore object like this:
import { firestore } from "firebase-admin";
But firestore can also be imported like this:
import firestore from '@react-native-firebase/firestore';
I removed the "firebase-admin" package and my problem was solved:)
"react": "^16.13.1"
"firebase": "^7.19.1"
"firebase-admin": "^9.1.1"
_./node_modules/hash-stream-validation/index.js_
Module not found: Can't resolve 'fast-crc32c'
_./node_modules/configstore/node_modules/write-file-atomic/index.js_
Module not found: Can't resolve 'worker_threads'
Facing this Issue while trying to add Firebase Admin SDK to my React Web app
@IamMasterWayne
The Firebase Admin SDK is a server only library, the errors you are seeing are due to this. If you need to do admin operations, you need to do it in a trusted environment and expose it via an API of some kind (lambda, rest etc etc).
"react": "^16.13.1"
"firebase": "^7.19.1"
"firebase-admin": "^9.1.1"_./node_modules/hash-stream-validation/index.js_
Module not found: Can't resolve 'fast-crc32c'_./node_modules/configstore/node_modules/write-file-atomic/index.js_
Module not found: Can't resolve 'worker_threads'Facing this Issue while trying to add Firebase Admin SDK to my React Web app
Do you find a solution to this?
Most helpful comment
@crossRT did you found any solutions? I try to use
firebase-adminwith Netlify functions and get similar errors.