Parse platform 解析云函数赢得';t返回response.success
My cloud函数调用我托管的web爬虫并检索回一个字符串,但我无法响应。如果字符串很长(出于某种原因,它只适用于短字符串),请将该字符串返回到我的应用程序。这是我的密码:Parse platform 解析云函数赢得';t返回response.success,parse-platform,httprequest,httpresponse,parse-cloud-code,Parse Platform,Httprequest,Httpresponse,Parse Cloud Code,My cloud函数调用我托管的web爬虫并检索回一个字符串,但我无法响应。如果字符串很长(出于某种原因,它只适用于短字符串),请将该字符串返回到我的应用程序。这是我的密码: Parse.Cloud.define("search", function(request, response){ Parse.Cloud.useMasterKey(); Parse.Cloud.httpRequest({ url: 'https://xxx.herokuapp.com/',
Parse.Cloud.define("search", function(request, response){
Parse.Cloud.useMasterKey();
Parse.Cloud.httpRequest({
url: 'https://xxx.herokuapp.com/',
params: {
keyword: request.params.searchTerm
},
success: function(httpResponse){
// The httpResponse.text is received but for some reason
// will not be returned with response.success
response.success(httpResponse.text);
}, error: function(httpResponse){
response.error(httpResponse);
}
});
});
我已经在这个问题上纠结了好几天,如果有任何帮助,我将不胜感激。我犯了一个愚蠢的错误,在将字符串返回到应用程序时似乎只需要以下内容:
response.success(JSON.parse(httpResponse.text));
我不确定为什么需要对较长的字符串执行此操作,对较短的字符串似乎也不重要,但我确信这是有原因的。这实际上会导致未捕获的SyntaxError:Unexpected token S in:1出现在某些字符串上,而不是其他字符串上。这是什么意思?