-
Notifications
You must be signed in to change notification settings - Fork 909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[9.5.0] Error: Cannot find module '@grpc/grpc-js/package.json' in electron #5752
Comments
First of all, Electron is not an officially supported platform, it is probably unsurprising that the SDK does not work there because we did not test on Electron. That being said, I did ask someone who knows a bit about Electron. It seems you are targeting |
Thank you for the response. I realize electron compatibility is not usually being tested by libraries out there... v8 does work for our flow without any special handling, so I thought it might not be as big of a gap to ensure v9 is working as well. I've tried using the browser bundles, but this proved more problematic. First, webpack didn't let me remap things like I've tried working around by: const firebaseRoot = path.dirname(require.resolve('firebase/package.json'));
module.exports: {
...
resolve: {
alias: {
`'firebase/compat/app': path.join(firebaseRoot, 'firebase-app-compat.js')
}
... While the original issue (grpc) was resolved, I now faced with the compat bundles not really exporting a So I got type checking (typescript) passing, but at runtime I got errors about not being able to call initializeApp on undefined. I even tried mapping it to I'm not sure what else I can try. These multi-module-format packages are supposed to be compatible with more cases, but in reality it's not simple to get the commonjs, esm, and (umd? iife?) bundles matching behavior and types. especially if one uses default export/import. |
btw I've just verified that if I change: Is there any chance the "hack" (as the comment calls it) could only be applied to the esm versions? (where I'm guessing it's needed for native node esm support) |
Similar issue arises on Google Cloud App Engine:
|
I'm seeing this issue on Vercel. Looks very urgent. |
To be clear it looks like using the latest Firebase on Vercel is currently completely broken. |
I can reproduce this with a minimal repo: https://github.com/ocavue/firebase-vercel-function-require-issue This repo is deployed to Vercel. Visit https://firebase-vercel-function-require-issue.vercel.app/oauth then you will see a 500 error page. The server-side log is:
It seems that this error has something to do with the |
I have the exact same issue when deploying a nextjs app to Amplify. Only one page that uses firestore functions that have this issue and the problem is happening on the server-side rendering. Any news on that? |
I have the same issue when deploying my server-side rendered Angular app to Google Cloud Run. It works only if I use |
I think I have a fix in #5771 but need to test it. I see the environments reported here that have this problem are:
It looks like all of those require cloud deployment to see the problem except Electron so I think I'm going to try the solution with Electron for faster iteration, unless anyone has a simpler and faster way to consistently reproduce the problem. I see someone provided a Vercel repro so I can also look into how quickly I can deploy a copy to Vercel. |
We had the same error last week in a containerized Angular SSR app we have just introduced Angularfire to (which is a wrapper of firebase-js-sdk). Ended up having to define @grpc/grpc-js in package.js and copy the lib into the container via the Dockerfile to stop this error from occurring. |
I have this issue when deploying Next.js 12.0.2 with Firebase 9.2.0 and up on AWS Amplify. Lambda functions throw error on invocation: Anyone found a working solution? Should I downgrade firebase back to v8? I really don't want to downgrade though.. UPDATE
Downgrading Firebase to 9.1.0 worked without breaking changes for me. |
I'm having the same issue deploying to Netlify (v9.2.0) Downgraded to 9.1.0 and It works fine. No breaking changes |
Fixed in v9.6.1 |
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
Steps to reproduce:
Using firebase inside an electron app. I'm trying to upgrade from v8 to v9, and am encountering the following error:
Our setup bundles the library using webpack with
electron-renderer
target. I guess the attempt to dynamically create require breaks out of the bundling process.Relevant Code:
The code that fails is:
Now, I realize this piece of code already came up in #5687
The chosen solution doesn't work for our use case, I believe.
The text was updated successfully, but these errors were encountered: