I am trying to write a cloud function that receives a csv log from a python server, then posts it to either a Firestore Database collection or a storage bucket. I am a little lost on how to continue. Any suggestions?
Related
Before I write to the Firebase database, I'd like to check if the write is valid via a Firebase function. When a user is online this is easy because I can put the Firebase database write in a completion callback which is fired after the server function returns. However, I'm not sure how to handle the offline case:
Since the server can't be reached offline, then the completion handler will never return and data will not be written to the Firebase database cache. However, if I bypass the server check when offline, when reconnected, the Firebase cache will sync and write possibly corrupt data to the Database (if the server would have caught it when online).
Here is an example:
checkWithServerIfDataIsSanitzied(data) { sanitized in
if sanitized {
// The problem is that this won't write to firebase if
// The user is offline since there is no connection to server.
writeToFirebaseDatabase(data)
}
}
What is the standard practice to write data offline when server code is required to validate?
Thanks
I was trying to host a website on firebase and this keeps coming up enter image description here
If you want to initialize a Firebase project using the CLI (like you're doing), and you want to use Firestore or Storage, you first have to go into the Firebase admin console, click on Firestore and/or Storage, and select a location/region for your database/storage buckets. The error you're getting is that you're trying to set up Storage but you haven't yet set a Storage location for your buckets.
I have an iOS App. Would like to explore what is needed to be done to achieve the following:
1) The user taps on the map
2) US Census Tract info is requested from database
3) Later the user wants to purchase this tract info.
The US Census Tract info would be uploaded to Cloud Object Storage.
There are 70,000 Tracts grouped by US States = 50 + 1 (DC)
I could use SQL Query to select one Census Tract by its ID.
In the iOS App I can use Apple Login and get users' name and email.
The question is how to grant/revoke access to this info automatically
after in-app purchase?
The question is two-fold. Do I have to create 70,000 CSV files and grant them an access to? Or this can be achieved dynamically with SQL?
The second part is - how to automate this process?
Does IBM Cloud has this capability?
I would expect that you would use a single Service ID that would have access to the data sitting in COS, and that a user's access to the underlying data would be handled in your application logic. The Cloud IAM access policies are not intended for end-users as much as for internal development/operations teams to manage access to various cloud resources.
Depending on the format of the census data, SQL Query could be a great way to do it. You could use SQL query to create a new object with the subset of data the user has requested, and then create a presigned URL that will expire in a whatever timeframe is reasonable, allowing the file to be downloaded to the client device.
Can we write batch inside a transaction in google cloud functions to access documents stored in cloud firestore? I tried using two transactions in cloud functions.
Is there a way to see and log the incoming calls to a firebase database? e.g.
GET 'https://XYZ.firebaseio.com/user/<RFID ID>/balance.json?auth=verysecrettoken'
Produce a log like:
Time, Date: incoming call "GET 'https://XYZ.firebaseio.com/user//balance.json?auth=verysecrettoken'" - reponse was "1"
The Firebase Database servers don't provide an accessible log of the incoming requests.
If you want something like this you could consider setting up a proxy server. Or log the events from the client into something like the Firebase Realtime Database (yes, ironic, I know) or Firebase Analytics.