Skip to content

[v9.0.2 auth] INTERNAL ASSERTION FAILED: Expected a class definition #5475

@bramvanneerven

Description

@bramvanneerven

In an effort to reduce the dependencies of the authentication code I use, I tried the following:

// Works
import { getAuth } from 'firebase/auth';
const auth = getAuth(app);

// ERROR!
import { browserLocalPersistence, initializeAuth } from 'firebase/auth';
const auth = initializeAuth(app, { persistence: browserLocalPersistence });
Error output
Error: INTERNAL ASSERTION FAILED: Expected a class definition
    at debugFail ({***path***}/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@firebase/auth/dist/node/index-012195c6.js:535:11)
    at debugAssert ({***path***}/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@firebase/auth/dist/node/index-012195c6.js:546:9)
    at _getInstance ({***path***}/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@firebase/auth/dist/node/index-012195c6.js:568:5)
    at Array.map (<anonymous>)
    at _initializeAuthInstance ({***path***}/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@firebase/auth/dist/node/index-012195c6.js:637:80)
    at {***path***}/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@firebase/auth/dist/node/index-012195c6.js:6979:13
    at Component.instanceFactory ({***path***}/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@firebase/auth/dist/node/index-012195c6.js:6981:11)
    at Provider.getOrInitializeService ({***path***}/node_modules/.pnpm/@[email protected]/node_modules/@firebase/component/dist/index.cjs.js:342:39)
    at Provider.initialize ({***path***}/node_modules/.pnpm/@[email protected]/node_modules/@firebase/component/dist/index.cjs.js:264:29)
    at initializeAuth ({***path***}/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@firebase/auth/dist/node/index-012195c6.js:632:25)
package.json
  "dependencies": {
    "@chakra-ui/react": "^1.6.7",
    "@chakra-ui/theme-tools": "^1.2.0",
    "@emotion/react": "^11.4.1",
    "@emotion/styled": "^11.3.0",
    "@xstate/react": "^1.6.1",
    "common-tags": "^1.8.0",
    "firebase": "^9.0.2",
    "framer-motion": "^4.1.17",
    "next": "11.1.0",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "react-icons": "^4.2.0",
    "sharp": "^0.29.1",
    "xstate": "^4.23.4"
  },
  "devDependencies": {
    "@types/common-tags": "^1.8.1",
    "@types/react": "17.0.18",
    "eslint": "7.32.0",
    "eslint-config-next": "11.1.0",
    "eslint-plugin-import": "^2.24.2",
    "lint-staged": "^11.1.2",
    "prettier": "^2.4.0",
    "simple-git-hooks": "^2.6.1",
    "typescript": "4.3.5"
  },

The problem seems to be here:

debugAssert(cls instanceof Function, 'Expected a class definition');

I did have a quick look, but could not really find the actual problem myself.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions