Как развернуть firebase?

avatar
Ariel Tarsitano
1 июля 2021 в 18:33
281
2
1

у меня проблема с развертыванием firebase, выполните команду в VS Code, появится следующее сообщение, Я попытался установить, удалить зависимость, и это не решение. Спасибо Терминал:

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.
Источник
Dharmaraj
1 июля 2021 в 19:02
0

Привет, пожалуйста, поделитесь своим кодом, чтобы мы могли увидеть, что не так. Первый взгляд говорит, что у вас есть неопределенный объект, и вы пытаетесь получить доступ к его свойству длины.

Ariel Tarsitano
2 июля 2021 в 14:30
0

Здравствуйте, свойство length было установлено с зависимостями от firebase-tools.

Ответы (2)

avatar
yshahak
29 июля 2021 в 05:55
0

Я столкнулся именно с этой проблемой. Как намекает @Sumit, после добавления явного использования в коде functions проблема решена.

exports.scheduledFunction = functions.pubsub.schedule('every 5 hours').onRun((context) => {
    console.log('This will be run every 5 hours!');
});
avatar
Sumit
5 июля 2021 в 15:41
1

У меня была такая же ошибка при новой установке. Я видел, что firebase init создала файл в functions/index.js Однако единственная определенная функция внутри этого закомментирована. Эта проблема была решена раскомментированием и экспортом функции.

Похоже, вы загружаете кучу файлов, вам нужны функции? Если вы выбрали «функции» во время инициализации, но ничего не определили, попробуйте это.