davecoates / rn-firebase-bridge

React Native Firebase Bridge
59 stars 8 forks source link

Error: ApplicationId must be set #31

Open calitbk opened 7 years ago

calitbk commented 7 years ago

Hi, i have installed your library 'rn-firebase-bridge', but when i launched app, i got a error like this: screenshot_1489922391

I do not unsderstand this error. Here is my code: // import * as firebase from 'firebase'; (1) import firebase from 'rn-firebase-bridge'; (2)

// Initialize Firebase const firebaseConfig = { ApplicationId: "vn.travel.localprice", apiKey: "real_api_key", authDomain: "real_auth_domain", databaseURL: "real_database_url", storageBucket: "real_storage_bucket", }; const firebaseApp = firebase.initializeApp(firebaseConfig, "package_name_in_android"); // firebaseApp.database().setPersistenceEnabled(true);

module.exports=firebaseApp;

when i use (1), everything is ok, but use (2) -> got above error.

Help me to solve it, please!

davecoates commented 7 years ago

Hi there,

Sorry, it's not documented but here's the valid keys for the options to pass to initializeApp:

googleAppID
bundleID
GCMSenderID
APIKey
clientID
trackingID
androidClientID
databaseURL
storageBucket
deepLinkURLScheme
calitbk commented 7 years ago

I tried, but anyway it still didn't work, i got a new error. Could you give me an example

Here is the error screenshot_1490082714

davecoates commented 7 years ago

Can you post your code please?

calitbk commented 7 years ago

const firebaseConfig = { googleAppID: "1:478133689317:android:027b27xxxxxxxxxx", ---- if it is not android api_key, i don't know what "googleAppId" is and where to get it bundleID: "vn.travel.xxxxxxxxxx", --- android package name clientID: "478133xxxxxx-09lv3c71bm5evhnunedjdggij8ifg3s4.apps.googleusercontent.com", --- get from client-sevices.json - firebase config file androidClientID: "478133xxxxxx-09lv3c71bm5evhnunedjdggij8ifg3s4.apps.googleusercontent.com", --- is it the same with clientID? deepLinkURLScheme: "not available", GCMSenderID: "4781xxxxxx", ----- gcm key trackingID: "not available", APIKey: "AIzaSyDCs7IaB7T1CHg7zxApmPaXixxxxxxxxxx", --- clear authDomain: "xxxxxxx.firebaseapp.com", --- clear databaseURL: "https://xxxxxx.firebaseio.com", --- clear storageBucket: "xxxxxx.appspot.com" --- clear }

const firebaseApp = firebase.initializeApp(firebaseConfig, "1:478133689317:android:027b27xxxxxxxx"); // firebaseApp.database().setPersistenceEnabled(true);

module.exports=firebaseApp;

Here is my code, i don't know what the "empty or null" error means.

davecoates commented 7 years ago

Are you then using that app for something - auth maybe?

davecoates commented 7 years ago

If you are doing app.auth() try this for now new Auth(app) (I think there's a bug where the app isn't ready yet so is missing the name)

You can also check ready status with the app.ready() promise:

await app.ready();
const auth = app.auth();
calitbk commented 7 years ago

maybe i miss some settings. Thanks a lot