-
Notifications
You must be signed in to change notification settings - Fork 893
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
@firebase/auth: Auth (10.3.0): INTERNAL ASSERTION FAILED: Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfillTitle for the bug #7633
Comments
To clear things up, we actually provide multiple ESM2017 bundles for auth, one for the browser, and one for Node. The file path you're looking at is the one for the browser. In a Node environment (which is NextJS's SSR environment), the default NextJS config should automatically pull the Node "import" bundle which is here:
Meanwhile, when NextJS is rendering client side, it uses a different config and should pull the browser ESM2017 bundle here:
The Node bundle calls FetchProvider.initialize() while the browser bundle does not, as it doesn't need to. When I've previously dug into Next, it looks like its default configuration correctly pulls the correct bundle for each use case. Are you using the default configuration or is it modified? What version of NextJS are you using? |
Firebase does work well on browser and Node environment. But there are also other JavaScript environments in addition to these two. Particularly, I see this error in a serverless function JavaScript environment called Vercel Edge Runtime, which is not a browser and not a Node environment. It provides some Web APIs like I know the Firebase team might only want to support browser and Node.js environments officially. However, my pull request seems to be minimal and harmless so I hope it can be accepted :) |
Sorry for the delay, the PR looks good, we just need to get it through CI again (added a comment in the PR). |
Operating System
N/A
Browser Version
N/A
Firebase SDK Version
[email protected], @firebase/[email protected]
Firebase SDK Product:
Auth
Describe your project's tooling
Next.js with Vercel Edge runtime.
Describe the problem
When running Firebase, I get the following error:
Steps and code to reproduce issue
I checked the code and I believe it's quite simple to verify this is a bug, and I will describe it below. Thus I don't provide a detailed repilication. Let me know if you still want me to prepare a minimal repo to reproduce this bug.
@firebase/[email protected]
provides multiple exports, shown in its package.json. One of them isdist/esm2017/index.js
.dist/esm2017/index.js
just re-exports some objects fromdist/esm2017/index-9a76d29a.js
.dist/esm2017/index-9a76d29a.js
definesclass FetchProvider
at line 742, and callsFetchProvider.fetch()
at line 915 and line 1470. However,FetchProvider.initialize()
has never been called in this file, andself
is not a standard JavaScript global property (it only exists in browser environment). That's why I get this error.The text was updated successfully, but these errors were encountered: