问题
this is my code. Why when I go to the url of my cloud function I receive this message :"Error: could not handle the request" and I didn't see "Hello World!" ? Thanks
exports.simple = (req,res) => {
var express = require('express');
var https = require('https');
var bodyParser = require('body-parser');
var app = express();
module.exports = app;
return app.get('/', (req, res) => res.send("Hello World!"))
.then((result) => {
console.log("DONE",result);
console.log("Delete opportunity");
})
.catch((err) => {
console.log("ERROR",err);
})
};
回答1:
I managed to make it work by placing all the code outside the default entry point and by setting the app variable as the new entry point.
来源:https://stackoverflow.com/questions/57587844/error-could-not-handle-the-request-with-google-cloud-function-and-express