Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
384 views
in Technique[技术] by (71.8m points)

node.js - call function after sails lifted

I am trying to call function that use firebase services after sails server start I have tried these ways in bootstrap.js file but it didn't work ,I think config folder run before sails server start I have search on it document but didn't found much help

The function I am trying to call have a cron jobs and this function exists on services folder

  sails.after("lift", function () {
       cronJob()
  });

 sails.on("lifted", function () {
    cronJob()
      });

I have put on my app.js

require('firebase-admin').initializeApp()

but every time I try to run another function using firebase services too it show me that error and when I comment cronJob() function error gone

{
    "code": "app/no-app",
    "message": "The default Firebase app does not exist. Make sure you call initializeApp() before using any of the Firebase services."
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...