Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/154.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Heroku 解析服务器中的app.post返回错误_Heroku_Http Post_Parse Server - Fatal编程技术网

Heroku 解析服务器中的app.post返回错误

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

我正在使用twilio并试图在index.js文件中发布我的
/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());
 });
});