While deploying my code I get the following error:
⚠ functions: failed to create function tests-testV2RefreshPodcast-testNewEpisodeMetadata
...
Functions deploy had errors. To continue deploying other features (such as database), run:
firebase deploy --except functions
Error: Functions did not deploy properly.
my code looks like this:
exports.testNewEpisodeMetadata = functions.database.ref(testPath.getNewEpisodeScenarioTrigger()).onUpdate(() => {
return Promise.all([])
})
Found out that it was because of a name size limit. Heres a valid path:
✔ functions[tests-testV2RefreshPodcast-testNewEpMeta]: Successful create operation.
Notice how I changed the name testNewEpisodeMetadata to testNewEpMeta
Related
I got this error after running npm run serve,
!! functions: Failed to load function definition from source: FirebaseError: Failed to load function definition from source: Failed to generate manifest from function source: Error: Service account object must contain a string "private_key" property.
Heres the screenshot of the logs
it seems service account issue heres my initialization
admin.initializeApp({ credential: admin.credential.applicationDefault(), });
i found the solution by commenting all of my codes , then theres new errors says , index.js not found , since im using typescript , and then i realised that im running the firebase deploy functions command using the wrong lib folder generated by typescript,
thats why i got these 2 erros:
Failed to generate manifest from function source: Error: Service account object must contain a string "private_key" property.
RangeError: Maximum call stack size exceeded.
Error ImageThere is no error when the code is being run using Firebase configuration directly. when I am putting firebase configuration key in the environment variable ,then it throw an error "Firebase:Error(auth/invalid-api-key)"
after adding environment variable you have to restart the live server.
i have problem with firebase deploy, execute the command in VS Code, showing me the next message,
I tried install, unistall dependency and no is the solution.
Thanks
Terminal:
jonatan#Jona:~/KOA/s2i-backoffice-web$ firebase deploy
=== Deploying to 'proyecto-s2i'...
i deploying functions, hosting
⚠ functions: package.json indicates an outdated version of firebase-functions.
Please upgrade using npm install --save firebase-functions#latest in your functions directory.
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i functions: ensuring required API cloudbuild.googleapis.com is enabled...
✔ functions: required API cloudbuild.googleapis.com is enabled
✔ functions: required API cloudfunctions.googleapis.com is enabled
i hosting[proyecto-s2i]: beginning deploy...
i hosting[proyecto-s2i]: found 263 files in public
✔ hosting[proyecto-s2i]: file upload complete
Error: An unexpected error has occurred.
File firebase-debug.log, this is the message
[debug] [2021-07-01T15:17:30.726Z] TypeError: Canno t read property 'length' of undefined
at Object.functionMatchesAnyGroup (/usr/local/lib/node_modules/firebase-tools/lib/deploy/functions/functionsDeployHelper.js:11:23)
at have.filter (/usr/local/lib/node_modules/firebase-tools/lib/deploy/functions/deploymentPlanner.js:25:56)
at Array.filter (<anonymous>)
at calculateRegionalFunctionChanges (/usr /local/lib/node_modules/firebase-tools/lib/deploy/functions/deploymentPlanner.js:25:17)
at Object.createDeploymentPlan (/usr/local/lib/node_modules/firebase-tools/lib/deploy/functions/deploymentPlanner.js:53:50)
at release (/usr/local/lib/node_modules/firebase-tools/lib/deploy/functions/release.js:24:48)
at process._tickCallback (internal/process/next_tick.js:68:7)
[error]
[error] Error: An unexpected error has occurred.
I had the same error with a fresh install.
I saw that firebase init had created a file at functions/index.js
However, the sole defined function inside that is commented out.
Uncommenting, and exporting a function resolved this issue.
Looks like you are uploading a bunch of files, do you need functions?
If you chose 'functions' during init, but did not define any, try this.
I just run into the exact issue. As hinted by #Sumit, After adding explicit use in code to functions, the issue solved.
exports.scheduledFunction = functions.pubsub.schedule('every 5 hours').onRun((context) => {
console.log('This will be run every 5 hours!');
});
I built this React App, that allows users to add todo item, and mark an item as completed/active. Todo items are stored in cloud firestore.
I want to enable full-text search on the app, and one way is to create a cloud function that writes index to Algolia whenever cloud firestore witnesses a create operation.
Inside my app root directory, I initialize cloud functions and then implement the onTodoAdded function. After done, I run firebase serve under functions directory and get the errors:
=== Serving from '/Users/evan/source/react-redux-todos'...
i functions: Preparing to emulate functions.
Warning: You're using Node.js v10.6.0 but Google Cloud Functions only supports v6.11.5.
i hosting: Serving hosting files from: build
✔ hosting: Local server: http://localhost:5000
error: SUPERVISOR error Error: listen EADDRINUSE 127.0.0.1:5001
at Server.setupListenHandle [as _listen2] (net.js:1335:14)
at listenInCluster (net.js:1383:12)
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1509:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:61:10)
error: supervisorPort (5001) is already in use
i functions: No HTTPS functions found. Use firebase functions:shell if you would like to emulate other types of functions.
For a complete debug log, find here.
However, this command works fine: firebase serve --only functions.
=== Serving from '/Users/evan/source/react-redux-todos'...
i functions: Preparing to emulate functions.
Warning: You're using Node.js v10.6.0 but Google Cloud Functions only supports v6.11.5.
i functions: No HTTPS functions found. Use firebase functions:shell if you would like to emulate other types of functions.
Since it says supervisorPort(5001) is already in use, I lsof -i:5001 and finds no process. I also shut down my laptop and restart, gets the same error.
I find the similar issue here, however didn't find the solution.
I still don't know the reason, but adding --port=9000 solves the problem. For example, firebase serve --only functions --port=9000. Credits to restPort (5001) is already in use #142.
I was having this same error after updating to macOS Mojave 10.14.1 (was fine with 10.14). error: supervisorPort (5001) is already in use and it led me down this rabbit hole of additional updates and configuration that eventually got it to work.
1 Update Node Packages
I updated these items to these versions (latest as of this writing)
firebase-functions: 2.1.0
firebase: 5.5.8
I deleted by node_modules folder and reinstalled all the packages.
2 Firestore Emulator Setup Required
Next time I attempted to serve, firebase gave me this error:
Setup required, please run: firebase setup:emulators:firestore
Because of the weird permissions issues I initially had with mac, I actually have to run
node_modules/.bin/firebase setup:emulators:firestore
3 Then.... Fix Java Runtime Issues
On my next serve attempt, I was presented with firestore: No Java runtime present, requesting install. Mac presents a popup leading to a page where you can "download java for mac". This isn't what you actually need. You really need the Java SE Development Kit which enables command line interface.
Then... You may get these errors the next time you try to serve.
error: restPort (5002) is already in use
error: SUPERVISOR error Error: listen EADDRINUSE 127.0.0.1:5001
at Object._errnoException (util.js:1022:11)
at _exceptionWithHostPort (util.js:1044:20)
at Server.setupListenHandle [as _listen2] (net.js:1351:14)
at listenInCluster (net.js:1392:12)
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1501:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:97:10)
error: supervisorPort (5001) is already in use
But Firebase still ended up continuing to successfully serve somehow, despite these errors. And it still shows my app over http://localhost:5000.
Hope this helps!
When deploying via firebase deploy --only functions I recently get the following error messages:
In the console:
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
i functions: packaged functions (90.26 KB) for uploading
✔ functions: functions folder uploaded successfully
i functions: updating Node.js 6 function firestoreEmail(us-central1)...
i functions: updating Node.js 6 function apiMain(us-central1)...
✔ functions[apiMain(us-central1)]: Successful update operation.
⚠ functions[firestoreEmail(us-central1)]: Deployment error.
Error setting up the execution environment for your function. Please try deploying again after a few minutes.
Functions deploy had errors. To continue deploying other features (such as database), run:
firebase deploy --except functions
Error: Functions did not deploy properly.
In the log:
{"#type":"type.googleapis.com/google.cloud.audit.AuditLog","status":{"code":13,"message":"Error setting up the execution environment for your function. Please try deploying again after a few minutes."},"authenticationInfo":{"principalEmail":"myemail#gmail.com"},"serviceName":"cloudfunctions.googleapis.com","methodName":"google.cloud.functions.v1.CloudFunctionsService.UpdateFunction","resourceName":"projects/myproject/locations/us-central1/functions/firestoreEmail"}