我有基本的 firebase 云功能。我想用 Axios 发布请求(发送 Slack 消息)。但服务器返回“错误:无法处理请求(500)”。哪里有问题?我用的是cors
const cors = require('cors')
const functions = require('firebase-functions')
const Axios = require('axios')
exports.sendMessage = functions.https.onRequest((request, response) => {
return cors()(request, response, () => {
return Axios.post(
`https://hooks.slack.com/services/*XXXXXXXXXXXXX*`,
{
blocks: [
{
type: 'section',
text: {
type: 'mrkdwn',
text: 'hello',
},
},
],
}
)
})
})
子衿沉夜
四季花海
相关分类