question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

StyledFirebaseAuth not working with nextjs

See original GitHub issue

I’m trying to get StyledFirebaseAuth to work with NextJS but I keep running into the following issues:

in the terminal when running next dev

wait  - compiling /_error (client and server)...
error - ./node_modules/firebaseui/dist/firebaseui.css
Global CSS cannot be imported from within node_modules.
Read more: https://nextjs.org/docs/messages/css-npm
Location: node_modules/react-firebaseui/FirebaseAuth.js

and in the browser

Module not found: Package path ./compat is not exported from package /Users/paymahn/code/lookieloo/node_modules/firebase (see exports field in /Users/paymahn/code/lookieloo/node_modules/firebase/package.json)
  2 | import {StyledFirebaseAuth} from "react-firebaseui";
  3 | import {auth} from "../lib/firebase";
> 4 | import firebase from "firebase/compat";
  5 | import 'firebase/compat/auth';

Here’s the entire tsx file I’m using to make a login page:

import React from 'react';
import {StyledFirebaseAuth} from "react-firebaseui";
import {auth} from "../lib/firebase";
import firebase from "firebase/compat";
import 'firebase/compat/auth';

const uiConfig = {
    signInFlow: 'popup',
    signInSuccessUrl: '/',
    signInOptions: [
        firebase.auth.EmailAuthProvider.PROVIDER_ID,
    ],
};


const Login = () => {
    return (
        <div>
        <StyledFirebaseAuth uiConfig={uiConfig} firebaseAuth={auth}/>
    </div>
    )
}

export default Login

I’ve also tried using FirebaseAuth instead of StyledFirebaseAuth but that results in the same issue.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
aabmetscommented, Oct 24, 2022

Can we please get an updated version of this module to work with Nextjs without using Firebase compatibility modules? Next Auth is too complicated.

0reactions
MartinXPNcommented, Oct 27, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Next.js Sign In page with Firebase UI (and Firebase Auth)
Before we begin, this blog assumes you already have a Firebase account and app set up. If you haven't yet, you can go...
Read more >
Issue while implementing firebaseUi auth in a nextjs project ...
I tried but not working. Nothing shows up on the page. I think the FirebaseUi integration is not mature for Nextjs.
Read more >
Upgraded to React 18, updated dependencies, fixed "AuthUI ...
If you need FirebaseAuth instead of the StyledFirebaseAuth , you can just remove the import ... StyledFirebaseAuth not working with nextjs #180.
Read more >
The Ultimate Guide To Firebase With Next.JS - Jarrod Watts
Learn How To Set Up Firebase With Next JS And Create A Cloud Firestore Database, GitHub Authentication, and Firebase Cloud Functions in Next...
Read more >
FirebaseUI for Web — Auth - Firebase Open Source
Firebase and FirebaseUI do not work when executed directly from a file (i.e. opening the file in your browser, not through a web...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found