Skip to content
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

breaking bug with Firebase #7864

Closed
PierBover opened this issue Jun 1, 2016 · 9 comments
Closed

breaking bug with Firebase #7864

PierBover opened this issue Jun 1, 2016 · 9 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@PierBover
Copy link

PierBover commented Jun 1, 2016

I'm not certain if this is a Firebase bug or a React Native one...

I'm building for Android. I haven't tried in iOS.

The error says:

undefined is not an object (evaluating 'a.toLowerCase')

I have started a fresh project with latest versions:

  "dependencies": {
    "firebase": "^3.0.3",
    "react": "^15.0.2",
    "react-native": "^0.26.2"
  }

I have tried putting node_modules/firebase/ in the .babelignore as suggested here. I'm not having the same error... but I tried just in case.

I'm only initialising firebase in the standard manner, otherwise the project is fresh created with react-native init MyProject:

        firebase.initializeApp({
            apiKey: "XXXXX",
            authDomain: "XXXXX",
            databaseURL: "XXXXX",
            storageBucket: "XXXXX",
        })

Here is a screenshot of the device:

screenshot_20160531-202012

@PierBover
Copy link
Author

If I remove the firebase.initializeApp bit the project runs fine.

@PierBover
Copy link
Author

This is the index.android.js

I've only added the firebase bit and the import.

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View
} from 'react-native';

import firebase from 'firebase';

class ASC extends Component {
    constructor(props){
        super(props)
        firebase.initializeApp({
            apiKey: "XXXXX",
            authDomain: "XXXXX",
            databaseURL: "XXXXX",
            storageBucket: "XXXXX",
        })
    }
  render() {
    return (
    ...
    );
  }
}

const styles = StyleSheet.create({
...
});

AppRegistry.registerComponent('ASC', () => ASC);

@PierBover
Copy link
Author

Same problem on iOS

image

@ide
Copy link
Contributor

ide commented Jun 1, 2016

Can you debug what's going on and identify the root cause?

@PierBover
Copy link
Author

I'm new to RN...

So I debugged in Chrome and got this.

image

After searching for This browser is not supported I found this on StackOverlfow:

The new Firebase Authentication currently doesn't work in React Native due to a dependency on the window object. We're looking if that's something we can improve, but no guarantees.

So it seems it's a known Firebase bug...

Closing this.

@PierBover
Copy link
Author

PierBover commented Jun 1, 2016

So this problem makes Firebase unusable with React Native.

The "workaround" is losing FB authentication and importing this directly:

var app = require('firebase/app');
var database = require('firebase/database');

and then simply:

app.initializeApp(...)

Losing auth, analytics, etc, basically makes Firebase unusable for React Native projects.

I've complained in the Firebase Google Group and I invite anyone wanting to use Firebase on RN to do the same.

@dcworldwide
Copy link

dcworldwide commented Jun 3, 2016

Ok I understand your workaround now.

I do need the auth module however, only for the api and now the Oauth UI flows. I tried to un-minify the fb js code and look for a solution but It didn't seem obvious to me at first glance.

I'm pretty determined to find a solution (and at least keep politely nudging google to restore compatibility).

Danijel

@PierBover
Copy link
Author

Yes, without auth it makes Firebase unusable for anything serious.

You also lose (at least) analytics...

@PierBover
Copy link
Author

@dcworldwide your options are as follow...

  1. Fix the JS SDK (probably impossible)
  2. Make a native to JS bridge like I outlined here using the native SDKs by Firebase
  3. Find another backend provider like Meteor

I'd say 2 is the best one... someone started a project but it's quite experimental and only for iOS. Also it seems abandoned.

@facebook facebook locked as resolved and limited conversation to collaborators Jun 1, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants