问题1 =>如果我仅使用functions.pubsub.schedule,则会出现CORS错误。
问题2 =>我只需要pubsub.schedule()。不是https.onRequest()
index.ts
import * as functions from "firebase-functions";
import * as admin from "firebase-admin";
const cors = require('cors')({origin: true});
admin.initializeApp();
export const functions.pubsub.schedule("every day 00:00").onRun(async context => {
console.log("Okay deploy Done");
console.log(context);
})
我需要两个函数https和pubsub,但是我收到Header CORS错误,所以我被添加了cors。函数不能像这样工作,但是无论如何我都需要这两个函数。
函数调用
import { AngularFireFunctions } from "@angular/fire/functions";
constructor(private fun: AngularFireFunctions) {})
this.fun.httpsCallable("AlienMain")(this.EmailsNotification)
.pipe(tap(_ => console.log("subscribe to topic")))
.subscribe(data => {
console.log(data);
});