Unexpected error when querying Google Play Developer API - firebase

We have been trying to set up the sample app for Play Billing workflow with subscriptions as we are looking to introduce subscriptions in our app. We wanted to have the ClassyTaxi app running end to end in order to understand the flows better. Although for past 2 days, we are only trying to debug issues and/or missteps because of some really poor documentation on Google's front.
After ensuring every single step was correctly followed, we were able to make some progress and have the app working with the correct Skus as configured in Play Console. But now the backend server (ClassyTaxiServer) is throwing below error:
"Unexpected error when querying Google Play Developer API. Please check if you use a correct service account" - "OtherError: The project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console.".
We have relooked, recreated the service account on the Cloud Console several times, but no luck.
The Play Console is correctly linked with the Google Cloud project and the access is correctly granted to the service account.
Anyone has any suggestions? How can a sample app be so difficult to set up and function as expected? Or are we doing something terribly stupid?
Please help.
Thanks.

I passed trough similar situation, and I get same issue. After checking I found a note in google documentation saying the following:
Note: As of December 1, 2019, the Google Play Developer API is available only for version 3 and higher. If you're using a lower version of the API, you must migrate to version 3 by this date. For more information on migrating to version 3, see Changes to the Google Play Developer API.
Investigating the implemented code I found that the sample uses v2 of the google API (check ./subscriptions/play-billing/PlayBilling.ts line 70). So to avoid this situation, you will need to set it to v3, and update googleapis dependency to latest version in package.json.
Additional Notes
After solving this issue, I had a different message in 'OtherError', this time is “The current user has insufficient permissions to perform the requested operation.”. I will note my solution here just someone passed through similar situation:
In google play console, and after clicking on 'Grant access' in 'API Access' tab, you will need to select the user and add some permissions to the user (in my case I set it to admin, but I think it's larger than needed), make sure also to add the app/apps you are listening to.
If the issue is still running, just edit any of your products or just try creating new one, this step will clear the google cash and refresh permissions. (Check this question).

Related

Log errors from app on Google Play using Crashlytics

Probably silly question, but is it possible to send errors using Crashlytics from users that downloaded my app from Google Play? Until now I was using Crashlytics to collect errors from my app distributed by Firebase (so it was only for me and invited people). But I have released my app on Google Play and I can't see any errors from devices that downloaded my app in Google Play. I read that when I link my Google app with Firebase I can see purchase and subscription and analytics but no mention of Crashlytics. So my question is.. Is it even possible? Thank you very much.
Is the package name the same on your "release" version on the store? If your test one was called com.patrik.coolapp.debug (which is the default if you're using a debug build) then you'll need to add com.patrik.coolapp as an App in your Project in the Firebase console.
If you already had Crashlytics set up (all the dependencies, added the plugin, FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true) somewhere in your app) then it should just work - here's some advice on testing:
https://firebase.google.com/docs/crashlytics/test-implementation?platform=android
So I finally made it..
I'd like to thanks to #cactustictacs for help.
The problem was that I did not integrate Google Play in project settings in Firebase, although it is saying that it is just for Analytics and Subscription.
Before I integrated Google Play in Firebase I tried to add FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true) .. it did not work, but I believe it could be usefull to someone.
It wouldn't be such a problem, but it is required to have Owner or Admin permissions on both Firebase account and Google Play console account (which I did not have). After I get the permissions, integration was enabled and I could see test crashes in Crashlytics.

Cannot access Firebase Storage after creating storage bucket in GCP Console

I noticed that Firebase wouldn't let me create a storage bucket asia-southeast1 so I upgraded my plan to blaze, went to the GCP console and created a bucket from there.
I did the same for Firestore and it's working fine.
However, after I created the storage bucket in GCP, and I came back to the Firebase console to access Firebase Cloud Storage, I keep receiving this error.
I don't see how creating a bucket in the GCP console may affect your Firebase project (unless you created a bucket named <your-project-name>.appspot.com).
These kinds of errors normally happen when a certain quota has been reached, and is usually solved by upgrading your project to a paid plan.
As you have already upgraded your project, please bear into account that billing updates usually take some time to be processed. Waiting a few hours, or maybe checking the next day whether your project has been successfully upgraded should do the trick.
If that does not help, verify whether you have actually upgraded your project - You can check that here. The Blaze Plan button should be grayed out with the message Current Plan.
The answer provided to this question may also be of help:
Try to activate this feature using an incognito window/private window
and disable all browser extensions
Try using a different browser (and make sure browser is supported)
Verify if there are any other programs that might be blocking your
connection such as antivirus, proxy or firewall. If yes, try to
disable them.
Connect using a different network.
Connect using a different device.
Check the Developer Tools Console for any errors.
For Safari: Safari > Preferences > Advanced > Check "Show Develop menu
in menu bar" Develop > Show Web Inspector > Console Tab
If none of these approaches work for you, consider contacting Firebase Support here.
I fixed mine by using the command to work on it using
firebase init storage
This would create the storage after that it would add a storage.rule in which you can update to your liking in your project .
Then you run this command
firebase deploy --only storage
This would initialize the Storage
If you are still having issues check out this link https://stackoverflow.com/a/74750337 which was also provided by firebase for me to fix the error

Firestore Database not functioning online

I have created a Cloud Firestore Database and have it in Test Mode which means the read and write rules are pretty open for the next 3 weeks.
However when I try to add collections or documents from the web interface they do not show up on the database. I was able to add collections and documents from my android app but even those when I try to view I get "Error loading Documents".
I have tried Firefox and Chrome to see if it was a browser issue and I have disabled my Antivirus (avast) as well to see if that was the issue but no success.
What could be the problem?
There is no way to debug or answer this, you require backend assistance: I suggest reporting the problem to Firebase support. but most likely by the time you get a response, the server will fix itself.
https://firebase.google.com/support/troubleshooter/contact

Google sign in with Flutter on Android Studio

I've been looking for an answer for way too long. I am trying to implement the google sign in method with flutter and firebase so that I can access my google agenda via the google API afterwards. I get the following error: E/FirebaseInstanceId( 6925): Google Play services missing or without correct permission.
Even with the code of this video : https://www.youtube.com/watch?v=NaFI6bVI_NY&t=239s I get the error.
So you can assume my code is the same as her.
Thank you.
Most probable reason you are facing this error is because your Emulator does not have Google Play services Installed,
So try checking avd manager and see if the emulator you are running has Play Store Services installed.
You can check that by the icon like shown below:
If there is no Play Store service installed on existing emulator then create a new device having Play Store Services.

Previewing failed, but deployment works

Background:
I'm quite new to App Maker, but have been involved in programming/IT for over 2 decades.
I have created an App Maker app, which works fine. It is deployed, and functions internally in our organization.
It accesses a Team Drive spreadsheet, makes modifications to it based on input criteria, and sends an email out to a hardcoded user. It uses no external GCP database or other resource.
The OAuth scopes it requires are:
admin.directory.user.readonly
drive.readonly
script.send_mail
spreadsheets
userinfo.email
Problem:
I can no longer preview the app.
When I click on "Preview" at the top right, a new tab opens and a spinning wheels seems to indicate that the preview is loading. Within about 4 seconds, the tab closes and the original tab (with the scripts, UI etc) gives a "Previewing failed. Dismiss" error in the bottom centre.
I am both able to deploy the exact same code/UI/etc, as well as run it without issue.
I do not know what I changed, since being able to preview the app, but cannot seem to regress to that state.
What I've tried:
Admittedly not much, as I don't know where to look. I'm rather certain that there must be some setting somewhere, but for all my googling, I've come up empty.
This can't be a client/server script or other syntax issue, as otherwise the deployment also wouldn't work.
With a more meaningful error, I would know where to look.
Expected Result:
Obviously, I should be able to preview the app if it is deployable.
Following #Morfinismo's comment, I contacted G Suite Support; my matter was escalated to the API Team.
I was asked by Google Cloud Support ("Support") to provide network traffic info using FiddlerCap. As I am on a linux machine and FiddlerCap is a windows application, I suggested alternatives (eg:Wireshark). It was eventually not required and never provided.
I noticed that on the Google scripts page, when accessing the project in question selecting "Preview", it was missing the following OAuth:
https://www.googleapis.com/auth/admin.directory.user.readonly
The functioning deployed version did not have this missing.
Still in the Preview, I selected "Stackdriver (logs)", which gave me an error that the project had been deleted. The actual wording was:
Access forbidden
Project XXXX is shut down and scheduled to be deleted. A project owner can cancel the shutdown on the projects list page.
Clicking on the link in the error "Go to projects list page" brought me to a page with the title "Resources pending deletion", which did not load a list of projects (but otherwise fully loaded) and would display the spinning wheel in perpetuity. I attempted this multiple times, including leaving it overnight once.
Support presumed that I had deleted the GCP project, although I honestly don't/didn't think I had. I also confirmed that creating new previews did not work, but creating new deployments did. I also confirm(ed) that this particular App Maker app did not require (eg) a GCP SQL database.
Support pointed me toward the following website: Google undelete project and I was asked to follow these steps (copy-pasted here):
a. For projectId, enter your project ID. From the screenshot you provided, this is "XXX (redacted)" (the quotes are just to emphasise the project ID, you shouldn't enter them.
b. Click EXECUTE.
c. You'll be prompted to grant authorisation, which may be preceded by a prompt to choose your admin account. Please do so.
d. You should receive a 200 response, with an empty body, that is {}.
e. Attempt to access the project via Project link (with the actual project id redacted here).
The above yielded some strange behaviour:
a. undeleteing the project gave it a different name that the App Maker app;
b. I notice that I had 3 other projects all called correctly (the App Maker app name).
c. When asked to reauthorize, I was provided with yet another project name ("Untitled project"), which was different from the correct one and different from the one in para. 7a, above.
d. I then also obtained another error in a new window which read:
That's an error
Request Details
(a bunch of stuff)
That's all we know.
Support advised that there may be a propagation issue, and that I should wait up to 30 minutes. I did, and it then worked! The only weird thing was the project name was wrong, but it was only for the preview, so I didn't really care.
If anyone needs additional information, I can PM screenshots I took along the way.
Hope this helps someone!
SJL

Resources