Greetings,
1. Firstly I wanted to ask whether is it possible to deploy both
Python and
JS functions in one go using '
firebase deploy --only functions'?
2. Currently my folder structure is as follows:
functions (directory)
|-- match (directory)
|-- main.py
|-- requirements.txt
|-- index.js
|-- jsFuncsFile.js
JS Functions are exported by jsFuncsFile.js all those are imported inside index.js and exported by index.js. Index.js has a few JS functions which are deployed when I run firebase deploy --only functions but the JS functions inside 'jsFuncsFile.js' are not deployed.
Terminal Log:
=== Deploying to 'abc-app'...
i deploying functions
i functions: preparing codebase default for deployment
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i functions: ensuring required API cloudbuild.googleapis.com is enabled...
i artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled...
✔ functions: required API cloudfunctions.googleapis.com is enabled
✔ functions: required API cloudbuild.googleapis.com is enabled
✔ artifactregistry: required API artifactregistry.googleapis.com is enabled
i functions: Loading and analyzing source code for codebase default to determine what to deploy
Serving at port 8756
shutdown requested via /__/quitquitquit
i functions: preparing functions directory for uploading...
i functions: packaged /Users/parthrasujangid/MyProj/Firebase Cloud Functions/stripe/functions (80.61 KB) for uploading
✔ functions: functions folder uploaded successfully
i functions: updating Node.js 18 (1st Gen) function createStripeCustomer(us-central1)...
i functions: updating Node.js 18 (1st Gen) function monthlyPayment(us-central1)...
i functions: updating Node.js 18 (1st Gen) function oneTimePayment(us-central1)...
i functions: updating Node.js 18 (1st Gen) function cleanupUser(us-central1)...
i functions: updating Node.js 18 (1st Gen) function confirmStripePayment(us-central1)...
✔ functions[confirmStripePayment(us-central1)] Successful update operation.
✔ functions[monthlyPayment(us-central1)] Successful update operation.
✔ functions[createStripeCustomer(us-central1)] Successful update operation.
✔ functions[cleanupUser(us-central1)] Successful update operation.
✔ functions[oneTimePayment(us-central1)] Successful update operation.
Function URL (monthlyPayment(us-central1)): <deployed_function_URL>
Function URL (oneTimePayment(us-central1)): <deployed_function_URL>
i functions: cleaning up build files...
✔ Deploy complete!
Index.js partial code: const functions = require('firebase-functions');
const admin = require('firebase-admin');
const jsFuncsFromAnotherFile = require('./jsFuncsFile');
const constants = require('./constants') // here a few string constants
// are defined and exported
... Func Body of following functions goes below ... createStripeCustomer,
monthlyPayment,
oneTimePayment,
cleanupUser,
confirmStripePayment,
userFacingMessage,
reportError
... Function body done ...
module.exports = {
...jsFuncsFromAnotherFile,
createStripeCustomer,
monthlyPayment,
oneTimePayment,
cleanupUser,
confirmStripePayment,
userFacingMessage,
reportError
};
I don't understand what is causing this problem.
Firebase-debug.json output:
[debug] [2023-08-03T23:28:42.581Z] Validating nodejs source
[debug] [2023-08-03T23:28:43.017Z] > [functions] package.json contents: {
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"serve": "firebase emulators:start --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "18"
},
"main": "index.js",
"dependencies": {
"@google-cloud/storage": "^6.11.0",
"axios": "^1.4.0",
"csv-writer": "^1.6.0",
"firebase-admin": "^11.8.0",
"firebase-functions": "^4.3.1",
"stripe": "^12.12.0"
},
"devDependencies": {
"firebase-functions-test": "^3.1.0"
},
"private": true
}
[debug] [2023-08-03T23:28:43.017Z] Building nodejs source
[info] i functions: Loading and analyzing source code for codebase default to determine what to deploy
[debug] [2023-08-03T23:28:43.018Z] Could not find functions.yaml. Must use http discovery
[debug] [2023-08-03T23:28:43.023Z] Found firebase-functions binary at '/Users/parthrasujangid/MyProj/Firebase Cloud Functions/stripe/functions/node_modules/.bin/firebase-functions'
[info] Serving at port 8148
[debug] [2023-08-03T23:28:43.302Z] Got response from /__/functions.yaml {"endpoints":{"createStripeCustomer":{"platform":"gcfv1","availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"serviceAccountEmail":null,"vpc":null,"eventTrigger":{"eventType":"providers/firebase.auth/eventTypes/user.create","eventFilters":{"resource":"projects/sofiit-app"},"retry":false},"labels":{},"entryPoint":"createStripeCustomer"},"monthlyPayment":{"platform":"gcfv1","availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"serviceAccountEmail":null,"vpc":null,"httpsTrigger":{},"entryPoint":"monthlyPayment"},"oneTimePayment":{"platform":"gcfv1","availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"serviceAccountEmail":null,"vpc":null,"httpsTrigger":{},"entryPoint":"oneTimePayment"},"cleanupUser":{"platform":"gcfv1","availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"serviceAccountEmail":null,"vpc":null,"eventTrigger":{"eventType":"providers/firebase.auth/eventTypes/user.delete","eventFilters":{"resource":"projects/sofiit-app"},"retry":false},"labels":{},"entryPoint":"cleanupUser"},"confirmStripePayment":{"platform":"gcfv1","availableMemoryMb":null,"timeoutSeconds":null,"minInstances":null,"maxInstances":null,"ingressSettings":null,"serviceAccountEmail":null,"vpc":null,"eventTrigger":{"eventType":"providers/cloud.firestore/eventTypes/document.update","eventFilters":{"resource":"projects/sofiit-app/databases/(default)/documents/stripe_customers/{userId}/payments/{pushId}"},"retry":false},"labels":{},"entryPoint":"confirmStripePayment"}},"specVersion":"v1alpha1","requiredAPIs":[]}
[info] shutdown requested via /__/quitquitquit