Google Cloud Endpoint API works correct but there are no records in log - google-cloud-endpoints

I use Google Cloud Endpoint API with Google cloud function backend.
I successfully call my functions as defined in the API "swagger" file and see all functions invocations in the cloud function log.
But Endpoint services of Google cloud console shows nothing. Also, there are no records in the endpoint log.
Any idea?

Related

What API restriction do I have to whitelist in order to use Firebase Cloud Messaging?

I am currently using Firebase in iOS app with flutter framework.
The default Google Cloud API key created by firebase has unrestricted access to APIs, so I want to restrict it to certain APIs that my app uses for security reasons.
However, after making API restrictions, almost all firebase related components work fine, but the app does not seem to be able to get Firebase Cloud Messaging Token (e.g. FirebaseMessaging.getToken() call fails). The app suppose to retrieve this token and send it to the backend server such that the server can send FCM messages, but when this call is made, it just hangs for a while and returns null.
When my app key has unrestricted access to APIs, it retrieves FCM token fine, but as soon as I restrict it, it fails to retrieve the token.
I currently have whitelisted following APIs for the Firebase iOS App Key.
Identity Toolkit API
Token Service API
Firebase Remote Config API
Firebase Dynamic Links API
FCM Registration API
Firebase Cloud Messaging API
I have gone through other API list and they do not seem to be related to Firebase Cloud Messaging at all, so I did not select anything else, so I am stuck. Has anyone else encountered this problem when they tried to restrict Firebase API key?
(I am attaching the full API permission list below.)
App Engine Admin API
BigQuery API
BigQuery Storage API
Cloud Build API
Cloud Datastore API
Cloud Debugger API
Cloud Deployment Manager V2 API
Cloud DNS API
Cloud Firestore API
Cloud Functions API
Cloud Logging API
Cloud Messaging
Cloud Monitoring API
Cloud OS Login API
Cloud Pub/Sub API
Cloud Resource Manager API
Cloud Run API
Cloud Runtime Configuration API
Cloud Scheduler API
Cloud Source Repositories API
Cloud SQL
Cloud SQL Admin API
Cloud Storage
Cloud Tasks API
Cloud Testing API
Cloud Trace API
Compute Engine API
Container Registry API
FCM Registration API
Firebase App Distribution API
Firebase Cloud Messaging API
Firebase Dynamic Links API
Firebase Extensions API
Firebase Hosting API
Firebase Installations API
Firebase Management API
Firebase Mods API
Firebase Remote Config API
Firebase Rules API
Google Cloud APIs
Google Cloud Storage JSON API
Google Play Android Developer API
IAM Service Account Credentials API
Identity and Access Management (IAM) API
Identity Toolkit API
Kubernetes Engine API
Legacy Cloud Source Repositories API
Maps Embed API
Maps JavaScript API
Maps SDK for Android
Maps SDK for iOS
Maps Static API
Mobile Crash Reporting API
Service Management API
Service Usage API
Stackdriver API
Street View Publish API
Street View Static API
Token Service API
You have to additionally white-list the Firebase Installations API.
Details can be found here:
https://github.com/firebase/firebase-android-sdk/blob/master/firebase-installations/API_KEY_RESTRICTIONS.md

Can I call a Google cloud function from Firebase hosting

Can I call a Google cloud function from Firebase hosting?? I have a Google cloud function with memory store and I have others APIs in cloud run. These APIs in cloud run are to be called from Firebase hosting because I want to have the same base URL client. Is it possible to call from Firebase hosting the Google cloud function written in python ?

I can't see any incoming requests in Google Cloud Endpoint console

I'm trying to configure Google Cloud Endpoint in front of Cloud Run. I decided to use the OpenAPI 2.0 standard so I can use Python 3.6.5 as a language to develop my backend.
I followed this guide https://cloud.google.com/endpoints/docs/openapi/get-started-cloud-run.
I've been able to set up a custom domain name for my Cloud Endpoints like api.example.com and I'm able to make API calls to my endpoints.
The only problem is that I can't see any incoming requests and any logs in my Cloud Endpoints console. I can only see them in the Cloud Run console.
How is possible? What am I doing wrong?
I also tried to create enable my Flask app to support another endpoint and I didn't update the openapi.yaml file with the new endpoint. My service is giving me answers if I make API calls to the new endpoints.
How is possible if I didn't update that file?
I'm starting to think that I didn't configure well the Cloud Endpoint and I'm making API calls directly to my Cloud Run service.

How do I send notifications from Google Cloud(GCP) via Firebase to an Android app

I know how to send messages from Firebase cloud messaging portal to an android device. But my server runs on Google Cloud, I do gcloud app deploy from my local machine and the app logic gets deployed on Google Cloud. Now, I want to send notifications, based on the data stored as Entities in GCP Datastore, to an Android App.
Notification messages can be sent from Firestore-Cloud Messaging portal to an Android device, if I could harness this Firestore Cloud Messaging API in my GCP logic, then my problem will be solved.
I'm trying to look for any examples or POC's.
you can use Cloud Functions to add such custom functionality...
for example: https://android.jlelse.eu/serverless-notifications-with-cloud-functions-for-firebase-685d7c327cd4
and there are Cloud Datastore Callbacks, which can be used as event triggers. most relevant for Cloud Functions might be the Google Cloud Datastore Node.js Client - in order to connect to the Datastore. here's one of my examples, it is written in AppScript (similar to Node.js), which also connects to a Cloud Datastore, with the service account JSON loaded from Google Drive.
however, in this case the Datastore would need to subsequently trigger an HTTP Trigger or Pub/Sub Trigger and the code behind that trigger could get more data from the Datastore or directly send the Firebase notification.
in Cloud Function there are just triggers for Cloud Storage, while the Pub/Sub (publish/subscribe) triggers can be used for just anything. The Datastore would need to publish whatever event (add/edit/update/delete) - while a Cloud Functions script would need to subscribe these events.
using Firebase as backend might be less effort, because data-change events/triggers are being supported out-of-the-box, without any HTTP interaction or Pub/Sub communication involved.

generating access token in Cloud Functions for service-service auth

I am trying to establish service-service authentication between Cloud Functions and Cloud Endpoints.
I am trying to send a HTTP request inside a Firebase Cloud Function to my API running on Google App Engine and managed by Google Cloud Endpoints.
As stated in google docs, the service account that Firebase Cloud Functions uses is ____#cloudservices.gserviceaccount.com
I added that issuer in the security definition of my openAPI config(cloud endpoints). However, I could not find a way to create an access token in Cloud Functions of that service account.
How can I generate an access token in Cloud Functions to authenticate itself to Cloud Endpoints? How am I supposed to sign the JWT on cloud functions to request an access token?
Use Application Default Credentials.

Resources