Heroku 解析服务器中的app.post返回错误
我正在使用twilio并试图在index.js文件中发布我的Heroku 解析服务器中的app.post返回错误,heroku,http-post,parse-server,Heroku,Http Post,Parse Server,我正在使用twilio并试图在index.js文件中发布我的/testing函数,但我得到一个错误错误:{unauthorized}。我觉得这和api键有关,但我不确定。我正在请求头中传递我的主密钥和应用程序id,但仍然会收到相同的错误。我正在发邮件到 var api = new ParseServer({ databaseURI: databaseUri || 'mongodb://xxxxxxx', cloud: process.env.CLOUD_CODE_MAIN || __dirnam
/testing
函数,但我得到一个错误错误:{unauthorized}
。我觉得这和api键有关,但我不确定。我正在请求头中传递我的主密钥和应用程序id,但仍然会收到相同的错误。我正在发邮件到
var api = new ParseServer({
databaseURI: databaseUri || 'mongodb://xxxxxxx',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
fileKey: process.env.FILE_KEY || 'xxxxxxxx',
appId: process.env.APP_ID || 'xxxxxxx', //
masterKey: process.env.MASTER_KEY || 'xxxxxx', // Add your master key here. Keep it secret!
serverURL: process.env.SERVER_URL || 'https://xxxxxxx.herokuapp.com/parse', // Don't forget to change to https if needed
liveQuery: {
classNames: ["Posts", "Comments"] // List of classes to support for query subscriptions
}
});
var app = express();
var twilio = require('twilio');
var mountPath = process.env.PARSE_MOUNT || '/parse';
app.use(mountPath, api);
app.post('/test', twilio.webhook({ validate: false }), function (req, res) {
console.log("use-sms") //Not printed, get the error "error:{unauthorized}"
from = req.body.From;
to = req.body.To;
body = req.body.Body;
gatherOutgoingNumber(from, to)
.then(function (outgoingPhoneNumber) {
var twiml = new twilio.TwimlResponse();
twiml.message(body, { to: outgoingPhoneNumber });
res.type('text/xml');
res.send(twiml.toString());
});
});