pubsub.schedule中的请求资源上没有“ Access-Control-Allow-Origin”标头存在

时间:2019-08-19 05:49:44

标签: angular firebase cors google-cloud-functions

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.

0 个答案:

没有答案