const cors = require('cors')({origin: true});
export const mailr = functions.pubsub.schedule('every 60 minutes').onRun(async context => {
cors(req,res() => {
console.log(context);
});
});
我正在使用onRun,然后如何在cors中传递要求?因为我没有使用function.https.onRequest();
我在下面遇到错误。我应该更改我的代码什么?
Access to fetch at 'https://us-central1-ryest.cloudfunctions.net/mailr' from origin 'http://localhost:4200' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.