Firebase Storage sample with 400 error - firebase

It seems the Storage sample [https://github.com/firebase/quickstart-js] sample has 400 error.
Failed to load resource: the server responded with a status of 400 (OK)
It seems the api key is wrong, but I actually copy it from firebase console.
My alive demo is here: https://fir-storage-25695.firebaseapp.com/
Thanks,

If you go a little deeper into your logs you will see that you are getting error auth/operation-not-allowed and it says "The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section.".
So, observing your code, on loading you are calling signInAnonymously()
and whats happening is that you haven't enabled the anonymous authentication on your firebase console. Make sure you go there and activate it.

Related

How to investigate errors in Firebase Remote Config API?

I see errors for the Firebase Remote Config API in the Google Cloud Console > API/Service Details metrics.
Looking at "Traffic by response code" I see that a specific API key is causing HTTP code 400 responses from the API for the method:
google.firebase.remoteconfig.v1.RemoteConfigService.FetchRemoteConfig
I'm not able to reproduce this issue locally so how can I find out more about these errors in the Google Cloud Console?
What I've checked so far:
The credential that is causing the errors is restricted to the correct package name and SHA-1 hash (hash taken from Google Play Console > App Integrity)
It's apparently not hitting a quota limit from looking at the quote graph
From the client side logs I only see the exception:
com.google.firebase.remoteconfig.g: The client had an error while calling the backend!
This is a standard error message used in the Remote Config SDK for a client error (ex: a connection timeout, SSL issue, etc.). I suggest that you double check your implementation. You could also use the Android network debugger to simulate the network calls, so it could create a handling mechanism to ensure that the actual device has a proper connectivity on doing the fetch.
You may also refer to the Stackoverflow post and the GitHub Link.
Google Developer Support pointed me to a known bug in the Firebase Remote Config library which has been fixed recently. Upgrading the library indeed fixed the issue.

Unable to call Firebase function from React.js application

I have a React.js application powered by a number of Firebase functions and real time database standing behind them. It has been working without any issue for the past 2-3 months and now I am getting a warning on the functions logs which says that:
#firebase/database: FIREBASE WARNING: {"code":"app/invalid-credential","message":"Credential implementation provided to initializeApp() via the \"credential\" property failed to fetch a valid Google OAuth2 access token with the following error: \"Failed to parse access token response: Error: Server responded with status 404.\"."}
The way I initialize firebase from my React.js application looks like this:
I have double-checked everything standing behind process.env and it seems to be as expected. The website written in React.js in hosted under the Firebase hosting.
And this is how Firebase functions connect to Admin SDK:
I am not sure what would be the issue here. Nothing has changes in the code base from our side. Not sure if Firebase changed something internally that we need to consider.
What solved the issue for me was to go to the google cloud console (where Firebase functions are also available). Then I opened one of the failing cloud functions and I navigated to
My_Function_Name/Edit/RUNTIME, BUILD AND CONNECTIONS SETTINGS/RUNTIME SERVICE ACCOUNT/
And then I noticed there that for all of my functions it was selected App Engine Default Service Account instead of Firebase Admin SDK. I never explicitly set the runtime to this option. So, when I brought it back to Firebase Admin SDK the error was gone I was able to use the application once again.

Google Firebase auth emulator always logs out user, and not isolating from production

I'm using Firebase auth, and my app is working fine. But when I run it in the emulator, I get a login event, followed immediately by a logout event (user=null). I am setting it up with firebase.auth().useEmulator('http://localhost:9099') as required.
I see this error in my Chrome dev tools log which may or may not be the cause:
POST http://localhost:9099/www.googleapis.com/identitytoolkit/v3/relyingparty/getAccountInfo?key=AIzaSyCwV8E9N0nw3euy7cJFhe-OY4j2iTuvXYZ 400 (Bad Request)
I do see the auth events in the emulator console:
Received a signed JWT. Auth Emulator does not validate JWTs and IS NOT SECURE
so I know it's touching the auth emulator. But, I see sign-in events and user creations in my real Firebase auth console, not my emulator console -- so it seems like it's only halfway using the auth emulator. Is there some trick to getting this to work locally?

How to solve Error -32000 received from application: Service protocol could not handle or find a handler for the requested method. error

I am trying to implement google sign-in feature in firebase into my flutter (android) app.
The sign-in works perfectly, but once I click hot restart after signing in the app I get the following error:
Error -32000 received from application: Service protocol could not handle or find a handler for the requested method.
Can anyone help me solve this problem?
This Error maybe due to an old google_sign_in plugin. You can update to the latest plugin or try running flutter clean

Where are the Firebase Access Denied messages logged on the server?

Where are the Firebase database rules "Access Denied" messages logged on the Firebase server?
We are using the JavaScript web version of Firebase client libraries. The answer below is referring to Android or iOS but can we get automatic logging / analytics on the Web version?
For example, one of our customers sees:
firebase issue Error: permission_denied at
/companydata/Global/eJztlD9PwzAQxb8K8pyBVqJDtkIpCtA/IpQFMRzJtbXq2NHlUhRV/e6ck4LKQioQagc23z3n+efn2Bs1JUx1AoyFCp83KmLM7rBSoZq7OVZWBWryWiCtgbWzjSK9JzAlynDs/IQcCdiRCs8DFRUTGczBFBioK2cZtEWK0lqcAqHlz64KbWmM/+beLQTC7Ck7h2hhHWGMQMlyqNGID1OJ22AfNVtQG+jsMj4F0hbKv0L0IAcSyrHrHx97s04r6Okn8vtfEmiF3JbjLeRg/6P8Pkqu8k5bkCNnsTobrfjLJjvHueSpy5ZtwP2yYAKj4UjAL4GKHbFw+XdfqhtyZb4rD01/oAkT3xFy7/jg3obaMNLOc5J7UQqVlBTO4oH67HXrZSxk2KiirD+eaplX8zEQ97ne+COsROpeSATk0jJhH0ivF6hry5qrceMzNXKbtu/y+E4I:
Client doesn't have permission to access the desired data.(…)
I'd like to see these errors in a log somewhere on the Firebase console.
Is there a place to see data rules denials?
Thanks!
There is no server-side location where these error messages are captured that you have access to.
You will have to reproduce the client's behavior locally or use the Firebase Database rules simulator to reproduce it.
I think that you have to do it (logging denied access), manually.
Firebase analytics collects some events by default. Here you can find the list of those events. And here is an example of how to add log events in android.

Resources