Ошибка развертывания firebase для облачных функций - PullRequest
1 голос
/ 08 мая 2020

Я пытаюсь развернуть приложение firebase, но, вероятно, файл index. js выдает ошибку. пожалуйста, помогите мне с этим. Я пытаюсь отобразить шаблон e js, используя данные из firestore.

мой индекс. js file

const functions = require('firebase-functions');
const express = require('express');
const firebase = require('firebase-admin');

const firebaseApp = firebase.initializeApp(
    functions.config().firebase
);
const app = express();

app.set('view engine','ejs');
//-------------------------------------------------------------------//

function getfacts(){
    const ref = firebaseApp.database().ref('users');
    return ref.once('bio').then(snap => snap.value());
}

app.get("/home",function(req,res){
    getfacts().then(bio =>{
        res.render("index",{bio : bio});

    });
});

exports.app = functions.https.onRequest(app);

ошибка, с которой я столкнулся: chahat@chahat: ~ / Desktop / firebase 2.0 $ развертывание firebase

    === Deploying to 'samsungmap-17515'...

    i  deploying firestore, functions, hosting
    Running command: npm --prefix "$RESOURCE_DIR" run lint

    > functions@ lint /home/chahat/Desktop/firebase 2.0/functions
    > eslint .


    /home/chahat/Desktop/firebase 2.0/functions/index.js
      18:17  warning  Unexpected function expression              prefer-arrow-callback
      19:5   error    Expected catch() or return                  promise/catch-or-return
      19:21  error    Each then() should return a value or throw  promise/always-return

    ✖ 3 problems (2 errors, 1 warning)
      0 errors and 1 warning potentially fixable with the `--fix` option.

    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! functions@ lint: `eslint .`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the functions@ lint script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

    npm ERR! A complete log of this run can be found in:
    npm ERR!     /home/chahat/.npm/_logs/2020-05-08T09_55_55_924Z-debug.log

    Error: functions predeploy error: Command terminated with non-zero exit code1
...