Ariel Tarsitano
Ariel Tarsitano

Reputation: 11

How do firebase deploy?

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.

Upvotes: 1

Views: 390

Answers (2)

yshahak
yshahak

Reputation: 5096

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!');
});

Upvotes: 0

Sumit
Sumit

Reputation: 41

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.

Upvotes: 1

Related Questions