google-cloud-functions

Firebase Cloud Function deploy tslint error

末鹿安然 提交于 2020-12-09 09:53:54
问题 I started a new Firebase project with the CLI. I'm using only Cloud functions and wanted to deploy some functions but Im getting this error functions@ lint: `tslint --project tsconfig.json` I already changed following lines: "npm --prefix \"$RESOURCE_DIR\" run lint", "npm --prefix \"$RESOURCE_DIR\" run build" to "npm --prefix \"%RESOURCE_DIR%\" run lint", "npm --prefix \"%RESOURCE_DIR%\" run build" because they also threw an error. What do I need to change? Edit: I created a new Firebase

Firebase Cloud Function deploy tslint error

有些话、适合烂在心里 提交于 2020-12-09 09:51:50
问题 I started a new Firebase project with the CLI. I'm using only Cloud functions and wanted to deploy some functions but Im getting this error functions@ lint: `tslint --project tsconfig.json` I already changed following lines: "npm --prefix \"$RESOURCE_DIR\" run lint", "npm --prefix \"$RESOURCE_DIR\" run build" to "npm --prefix \"%RESOURCE_DIR%\" run lint", "npm --prefix \"%RESOURCE_DIR%\" run build" because they also threw an error. What do I need to change? Edit: I created a new Firebase

How to detect if environment is development or production with Firebase Cloud Functions?

假如想象 提交于 2020-12-08 06:53:05
问题 How can I detect if my server environment is development or production with Firebase Cloud Functions? I need something like this: if(process.env.NODE_ENV === 'development'){ //DO STUFF SPECIFIC TO DEV ENVIRONMENT } else if(process.env.NODE_ENV === 'production'){ //DO STUFF SPECIFIC TO PRODUCTION ENVIRONMENT } 回答1: process.env.FUNCTIONS_EMULATOR At process.env , on firebase functions projects, there is a boolean variable called FUNCTIONS_EMULATOR , which indicates if the process is running on

Hide Cloud Functions execution behind Cloud Endpoints

我只是一个虾纸丫 提交于 2020-12-06 12:10:05
问题 I was wondering if is possible to restrict/hide the direct access to my cloud function using cloud endpoints. I followed this tutorial from Google. On the link it says that: With this set up, ESP intercepts all requests to your functions and performs any necessary checks (such as authentication) before invoking the function I managed to complete the tutorial, adding a JWT authentication mecanism on the endpoint. But even though I can access with the URL from the CloudRun/ESP (with the

Hide Cloud Functions execution behind Cloud Endpoints

筅森魡賤 提交于 2020-12-06 11:54:06
问题 I was wondering if is possible to restrict/hide the direct access to my cloud function using cloud endpoints. I followed this tutorial from Google. On the link it says that: With this set up, ESP intercepts all requests to your functions and performs any necessary checks (such as authentication) before invoking the function I managed to complete the tutorial, adding a JWT authentication mecanism on the endpoint. But even though I can access with the URL from the CloudRun/ESP (with the

Hide Cloud Functions execution behind Cloud Endpoints

梦想的初衷 提交于 2020-12-06 11:53:31
问题 I was wondering if is possible to restrict/hide the direct access to my cloud function using cloud endpoints. I followed this tutorial from Google. On the link it says that: With this set up, ESP intercepts all requests to your functions and performs any necessary checks (such as authentication) before invoking the function I managed to complete the tutorial, adding a JWT authentication mecanism on the endpoint. But even though I can access with the URL from the CloudRun/ESP (with the

how to update multiple documents from cloud function in firestore database?

邮差的信 提交于 2020-12-05 12:37:08
问题 I am new to firebase cloud functions and I want to update username field of some documents from posts collection when the users collection changes it username field of a particular document. I use the following code to do that: exports.updateProfileUsername = functions.firestore .document('users/{userId}') .onUpdate((change, context) => { const {userId} = context.params; var newUsername = change.after.data().username; var previousUsername = change.before.data().username; if (newUsername

How to use ES6(esm) imports/exports in cloud functions

做~自己de王妃 提交于 2020-12-05 11:56:51
问题 import functions from 'firebase-functions'; import UtilModuler from '@utilModuler' exports.helloWorld = functions.https.onRequest((request, response) => { response.send("Hello from Firebase!"); }); import UtilModuler from '@utilModuler'; ^^^^^^^^^ SyntaxError: Unexpected identifier at Module._compile (internal/modules/cjs/loader.js:721:23) Caveats I'm using third party libraries(@utilModuler) which were written via import/exports. Possible workarounds: Fork library and generate cjs file with

Firebase storage artifacts is huge and keeps increasing

限于喜欢 提交于 2020-12-04 17:43:45
问题 I've just noticed that my app's storage was bumped almost to it's 5GB limits of free usage within the last few weeks. After checking it in more details, it appeared that this was caused by the "artifacts" bucket. I saw this SO question which says that the "artifacts" bucket is related to Node 10 environment. I indeed moved to Node 10 a month ago, but after figuring out that the logs are no longer structured in the firestore functions console, I've reverted back to Node 8 a few days later and

Firebase storage artifacts is huge and keeps increasing

痞子三分冷 提交于 2020-12-04 17:41:32
问题 I've just noticed that my app's storage was bumped almost to it's 5GB limits of free usage within the last few weeks. After checking it in more details, it appeared that this was caused by the "artifacts" bucket. I saw this SO question which says that the "artifacts" bucket is related to Node 10 environment. I indeed moved to Node 10 a month ago, but after figuring out that the logs are no longer structured in the firestore functions console, I've reverted back to Node 8 a few days later and