我正在使用配置了 slack 命令的 slack APP,这些命令将消息发布到我的 firebase 函数。这工作正常。现在我需要启动一个对话框。所以,我确实创建了一个新的 slack 命令并指向我的云功能。我正在执行以下操作,但收到 500 错误并且无法理解。请指教
import * as rp from "request-promise-native";
export const queue_command = functions.https.onRequest(async (request, response) => {
var payload =
{
"trigger_id": request.body.trigger_id,
"dialog": {
"callback_id": "send_feedback",
"title": "Request a Ride",
"submit_label": "Request",
"notify_on_cancel": true,
"elements": [
{
"type": "text",
"label": "Pickup Location",
"name": "loc_origin"
},
{
"type": "text",
"label": "Dropoff Location",
"name": "loc_destination"
}
]
}
}
console.log('trying response uri:' + request.body.response_url)
const options = {
uri: request.body.response_url,
method: "POST",
json: true,
body: payload,
headers: {
'content-type' : 'application/json'
}
};
console.log("sending data as:" + JSON.stringify(options))
rp(options).then(function(body){
return response.send("hang on...")
})
}
我没有看到它仅与服务错误一起工作。firebase 日志是
StatusCodeError: 500 - "no_text"
at new StatusCodeError (/user_code/node_modules/request-promise-native/node_modules/request-promise-core/lib/errors.js:32:15)
at Request.plumbing.callback (/user_code/node_modules/request-promise-native/node_modules/request-promise-core/lib/plumbing.js:104:33)
at Request.RP$callback [as _callback] (/user_code/node_modules/request-promise-native/node_modules/request-promise-core/lib/plumbing.js:46:31)
at Request.self.callback (/user_code/node_modules/request/request.js:185:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (/user_code/node_modules/request/request.js:1157:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (/user_code/node_modules/request/request.js:1079:12)