Questions tagged [google-cloud-functions]
2093 questions
0
votes
0
answer
6
Views
why i am receiving this error in ship engine api tracking?
I am trying to implement tracking module in ship engine. While generating branded tracking page URL I am receiving the following error with status code 400.
What does that error mean?
'request_id': '0697e518-6309-4215-96c1-6ed294c1fc88',
'errors': [
{
'error_code': '',
'message': 'trackingPageReques...
1
votes
1
answer
620
Views
Trigger a PubSub message from Cloud Functions
Firebase docs mention a straightforward way of subscribing to a pubSub topic.
Does Cloud Functions or Firebase Admin SDK provide a way to publish pubSub events or we are limited to what is described in Google Cloud Platform docs: https://cloud.google.com/pubsub/docs/publisher#pubsub-publish-message...
1
votes
1
answer
260
Views
Firebase deploy get ID with onCreate for push notifications
I'm creating an iOS app and sending notifications. I'm trying to get an id from Firebase but the code below doesn't work.
exports.pushNotifications = functions.database.ref('/message/{messageId}')
.onCreate((snap, context) => {
var messageId = event.params.uid;
.
.
.
I tried this code from the docum...
1
votes
1
answer
152
Views
Permission denied when creating a storage trigger with a named storage bucket
Insufficient permissions to (re)configure a trigger (permission denied for bucket images). Please, give owner permissions to the editor role of the bucket and try again.
I am pretty new to firebase. I am trying to implement that if i upload image it resizes it and change the name.
The bucket name in...
1
votes
2
answer
2.9k
Views
When using the onUpdate function in Firebase, how do I retrieve the record that has been updated?
When using the cloud functions on firebase, with the onUpdate trigger, how do I retrieve the record that has been updated (in other words, the record that triggers the function)? I am using JavaScript to interface with the Firebase database.
1
votes
1
answer
674
Views
Firebase StartAfter in query not working as expected
I am using firebase firestore as my database and i have written firebase functions to retrieve data from the firestore database.
What i am trying to achieve is pagination and as per the docs i have implemented the code for my firebase function. Below is the code:
exports.getBillList = functions.htt...
1
votes
1
answer
513
Views
missing script: build - firebase deploy
When I deployed my firebase function project, this error appeared 'missing script:build' and I try to fix it but it fails.
Please help me
This is error screenshot
1
votes
1
answer
197
Views
How/Can I manually call a trigger Firebase Function?
In our app we are constantly using callable functions and sometimes the cold start can be a headache, given the fact that we are still developing it and there are no users using them other than us.
What we thought to speed up this process is to call every function (they're not much, around 20 at the...
1
votes
1
answer
854
Views
Sending E-Mail through firebase functions
Its there a way to use an API like(sendgrid, mailgun) to send Email through Firebase cloud functions
or it is considered as an Outbound connection?
1
votes
2
answer
37
Views
Cloud fuction storage trigger on bucket of other project
Not able to create cloud function trigger on bucket which is under other project.
Deploying function (may take a while - up to 2 minutes)...failed.
ERROR: (gcloud.functions.deploy) OperationError: code=7, message=Insufficient permissions to (re)configure a trigger
(permission denied for bucket ing-a...
-2
votes
2
answer
31
Views
Making a cloud http function that runs indefinitely
Answered in the comments by Chris G:
Use setInterval instead, and remove the while loop; this code will call clearData in rapid succession, infinitely. (and a cronjob is definitely preferable to this setup, btw)
I need to make a http function that only calls one time (at launch) and after that runs...
0
votes
0
answer
18
Views
How can I use firebase functions efficiently?
I'm using Firebase Functions for the mobile project. I have never used firebase functions other projects. I want to learning to efficiently usage. Please write me your suggestions and mistakes.
My code in index.js;
const load = () => {
....
}
const soapValidate = () => {
....
}
const loginParse = (...
0
votes
0
answer
5
Views
No module named psycopg2._psycopg2 on Google Cloud Functions
I have a Google Cloud Function that uses Google Cloud SQL through psycopg2. I have psycopg2 in my requirements.txt but once the service updates I get the error No module named psycopg2._psycopg2.
Is this a problem with psycopg2's C libraries running in the Cloud Function's environment? How do I fix...
1
votes
2
answer
898
Views
Local dependencies in Cloud Functions for Firebase
When I try to deploy my functions, firebase complains about this:
const admin = require('firebase-admin');
const functions = require('firebase-functions');
const C = require('../both/constants.js');
exports.myFunc = functions.database.ref('aRef').onCreate((event) => {
// blah blah
}
Error: Error par...
1
votes
1
answer
1.7k
Views
Cloud Functions timer
I need to create a cloud function that initiates a timer that calls another cloud function after X minutes. It should repeat this N times, unless it's told to stop before N has been reached. Is this possible? I have been reading that you can only set up timers using external cron jobs or an app engi...
1
votes
1
answer
1.8k
Views
Send a POST request via Axios to a Firebase Cloud Function
I try to send a simple request to a Firebase function, but I get the same error every time... Apparently, the Firebase function does not receive the data I want to transmit from the Axios request.
This is the Firebase function :
[...] // Some imports
exports.completeProfile = functions.https.onReque...
1
votes
2
answer
2.4k
Views
How to read a JSON file data and use it in firebase cloud function
I have a firebase cloud function which will be invoked on HTTP request which is working fine.
Now, I want to read data from a JSON file for some business logic. Below are the 2 ways I was trying to read the JSON file:
Option #1) Saved the JSON file inside 'public' directory in my nodejs project and...
1
votes
1
answer
125
Views
My Firebase Cloud Function fails with Object.value is not a function error?
Why am I getting the following error when I try to fetch the values of my Firebase child nodes under registrationTokens:
Database structure:
'fcmtokens' : {
'dBQdpR7l1WT2utKVxdX2' : {
'registrationTokens' : {
'O': ''c4PSCAUAg5s:Yw95DyVxwElE88LwX7'
}
}
}
Console output:
TypeError: Object.values is n...
1
votes
2
answer
33
Views
Use Google Cloud Functions to speed up GAE app
I have a GAE standard Python app that does some fairly computational processing. I need to complete the processing within the 60 second request time limit, and ideally I'd like to do it faster for a better user experience.
Splitting the work to multiple threads don't seem to be a good solution becau...
1
votes
1
answer
114
Views
GCP Cloud Functions - Memory Consumption
How does Cloud Functions compute memory consumption?
Is it the total amount memory of all the functions that are currently running at the moment?
Let's say:
Total Memory assigned 512 MB.
3 running functions with 60MB each.
Does it mean we use 180MB in total? Or does each function gets it's own memor...
1
votes
1
answer
60
Views
Cloud function deployment time
I am deploying a function to cloud function, but it takes substantial time to deploy. How can I optimize my deployment?
I have tried deployed with and without go.mod. I have also tried include vendor (go mod vendor).
gcloud functions deploy FuncX --entry-point FuncX --runtime go111 --trigger-http
1
votes
2
answer
60
Views
How to fix Typescript error “Object is possibly 'undefined'”
I'm building a cloud function that will use the Stripe API to process payments. This is within a firebase project. When I run firebase deploy I get the error 'Object is possible 'undefined'' const existingSource = customer.sources.data.filter( (s) => s.id === source).pop();
I'm not sure how to resol...
1
votes
1
answer
57
Views
Combining Firebase Data Triggers .create .update (and perhaps .remove) in Cloud Functions
We can write a cloud function (e.g. in python) as follows:
def some_function_update(data, context):
# do some operations
return True
And invoke it when a change on the Firebase Database happens. For instance, if the following node changes, with the dynamic parameters yyyymmdd and alert_id:
/alerts/{...
3
votes
1
answer
95
Views
Firebase messaging Typescript: How import Message type?
I'm new using typescript with Firebase and I've some problems importing clases.
In order to have an OOP development I was reading the firebase-admin/index.d.ts file and I think would be useful the following types: TokenMessage, TopicMessage, ConditionMessage, etc ...
And my problem is I don't know...
1
votes
1
answer
330
Views
Firebase: functions: Error from emulator. Error: Timeout waiting for emulator start
Unable to launch firebase serve --only functions,hosting due to following error:
⚠ functions: Failed to load functions source code. Ensure that you have the latest SDK by running npm i --save firebase-functions inside the functions directory.
⚠ functions: Error from emulator. Error: Timeout wa...
1
votes
0
answer
161
Views
How to use same function for Dev and Production - Firebase
I am new to firebase and cloud functions, please try to help.
I have an app that uses cloud function to call external APIs. As my app is now live and consuming those APIs through cloud functions. I have to develop new features in my app using Dev environment without disturbing Live functions.
There...
1
votes
2
answer
1k
Views
Firebase Deployment error. Failure in the execution environment
While deploying project to firebase getting following error:
Deployment error.
Failure in the execution environment
It happens randomly during some functions. While it may fail once for certain functions, on another attempt it might work without error or show error with some different functions.
Ple...
1
votes
0
answer
420
Views
Cannot encode type ([object Object]) to a Firestore Value error while attempting pagination
So here I have my code
notifull.get('/getNote', (request, response) => {
// START Get variables
var requestData = {
// location properties
subject: request.query.subject,
category: request.query.category,
subcategory: request.query.subcategory,
// easy way to get full reference string
referenceStrin...
1
votes
1
answer
337
Views
Require key file by path in Google Cloud Function
I have the functions for Google Cloud Function that needs to require json key file.
For example:
const SERVICE_ACCOUNT_EMAIL = '[email protected]';
const SERVICE_ACCOUNT_KEY_FILE = require('./path/to/your/service_account.json');
const jwtClient = new google.aut...
1
votes
1
answer
254
Views
Speeding up Cloud Functions
I have a simple function that just executes a transaction to help keep a count of a list.
However, I am noticing when I run it, it takes nearly 5 seconds to execute, which seems really slow for how simple the function is. Is there anything I can do or a faster way to keep a counter?
exports.CountCom...
1
votes
0
answer
602
Views
Reading firebase data to answer Dialogflow query from Firebase Database
Thanks for your time in reading this query. I am implementing a Dialogflow bot using google cloud functions and firebase.
The use case, I wish to design is that
User says 'I wish to know information about New York'
Dialog flow captures the intent 'lookingForInformation' with Geo.City parameter as '...
1
votes
2
answer
291
Views
How to I pass a Stripe Firebase Cloud Function Error To The Client
When I create a cloud function to process a charge on a user’s card (by writing a stripe token to firebase and using a cloud function to charge), how do I pass errors (like a declined card due to insufficient funds) to the client. If it’s important, I’m using the firebase web sdk to send the t...
1
votes
0
answer
286
Views
Google Cloud Dataprep - Scan for multiple input csv and create corresponding bigquery tables
I have several csv files on GCS which share the same schema but with different timestamps for example:
data_20180103.csv
data_20180104.csv
data_20180105.csv
I want to run them through dataprep and create Bigquery tables with corresponding names. This job should be run everyday with a scheduler.
Righ...
1
votes
1
answer
498
Views
run python script from index.js cloud function
I am trying to run a python script from a node.js- cloud functions index file.
in order to access python script, I am also using 'python-shell' ...
the problem is every time I run deploy my functions of the index.js file,
it prints this error:
Error: python: can't open file '../Python36/fListener.py...
1
votes
0
answer
56
Views
How to avoid Array-Like behavior in Firebase
Firebase works in this way:
// we send this
['a', 'b', 'c', 'd', 'e']
// Firebase stores this
{0: 'a', 1: 'b', 2: 'c', 3: 'd', 4: 'e'}
// since the keys are numeric and sequential,
// if we query the data, we get this
['a', 'b', 'c', 'd', 'e']
// however, if we then delete a, b, and d,
// they are n...
1
votes
0
answer
91
Views
Cloud Function for Firebase is not always triggered after a file is stored on Cloud Storage
I am triggering a Cloud Function when a file is stored on Cloud Storage to either blur an image or create a thumbnail for the image. I am experiencing that the Cloud Function is not always triggered when the file updated on Cloud Storage. I don't see any errors on the Logs console. I just don't see...
1
votes
1
answer
277
Views
Does not Cloud Spanner manage sessions properly?
I have looked up for this issue but could not find any sufficient information about it.
Google Cloud Spanner client libraries handles sessions automatically and its limit is 10.000 sessions for each node, no problem till here.
I have a micro serviced application which also has Google Cloud Functions...
1
votes
1
answer
1.2k
Views
Error: Cannot find module 'grpc_node.node'
I'm using Firebase Hosting and Cloud Functions. When I execute firebase serve --only functions I got this error :
Cannot start emulator. Error: Cannot find module '/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/src/node/extension_binary/node-v57-darwin-x64-unknown/grpc_node.node'
I in...
1
votes
0
answer
220
Views
get facebook graph api response with google cloud functions
I am currently developing an Android app that outputs the posts of a Facebook page.
Of course I want to notify the app users about new posts. Then I connected my app to Firebase Notification. When I enter and send a message there, a push message is displayed on the mobile phone. Of course I don't wa...
1
votes
0
answer
108
Views
FCM structure with Cloud Functions Android
I need to send some data from one user to another. Once a user sends that data, the other user can either decline or accept it. Now, I have a couple of questions. How should I be structuring my database to store FCM tokens? Should the tokens be under a node such as users/{username}? If that is the c...