执行无误后不调用回调
Callback is not called after execution without any errors
我正在努力处理以下代码。请求已发送但未调用回调。我也没有收到任何错误,但已发送电子邮件!你有什么想法吗?
var userPointer = webhook.get("user");
userPointer.fetch().then(function(user){
Parse.Cloud.httpRequest({
method: 'POST',
headers: {
'Content-Type': 'application/json; charset=utf-8'
},
url: 'https://mandrillapp.com/api/1.0/messages/send-template.json',
body: {
template_name: webhook.get("mandrillTemplateSlug"),
template_content: null,
key: user.get("apiKey"),
message: {
subject: webhook.get("subject"),
from_email: "example@mail.com",
from_name: "System",
to: userData
},
async: false
}
},{
success: function(httpResponse) {
console.log(httpResponse);
},
error: function(error){
console.log(error);
}
});
});
您已将选项对象分成两个单独的对象:
Parse.Cloud.httpRequest({
method: 'POST',
headers: {
'Content-Type': 'application/json; charset=utf-8'
},
url: 'https://mandrillapp.com/api/1.0/messages/send-template.json',
body: {
template_name: webhook.get("mandrillTemplateSlug"),
template_content: null,
key: user.get("apiKey"),
message: {
subject: webhook.get("subject"),
from_email: "example@mail.com",
from_name: "System",
to: userData
},
async: false
}
}, { // <=== Remove these, replace with just a comma
success: function(httpResponse) {
console.log(httpResponse);
},
error: function(error) {
console.log(error);
}
});
应该只有一个,像这样:
Parse.Cloud.httpRequest({
method: 'POST',
headers: {
'Content-Type': 'application/json; charset=utf-8'
},
url: 'https://mandrillapp.com/api/1.0/messages/send-template.json',
body: {
template_name: webhook.get("mandrillTemplateSlug"),
template_content: null,
key: user.get("apiKey"),
message: {
subject: webhook.get("subject"),
from_email: "example@mail.com",
from_name: "System",
to: userData
},
async: false
},
success: function(httpResponse) {
console.log(httpResponse);
},
error: function(error) {
console.log(error);
}
});
我正在努力处理以下代码。请求已发送但未调用回调。我也没有收到任何错误,但已发送电子邮件!你有什么想法吗?
var userPointer = webhook.get("user");
userPointer.fetch().then(function(user){
Parse.Cloud.httpRequest({
method: 'POST',
headers: {
'Content-Type': 'application/json; charset=utf-8'
},
url: 'https://mandrillapp.com/api/1.0/messages/send-template.json',
body: {
template_name: webhook.get("mandrillTemplateSlug"),
template_content: null,
key: user.get("apiKey"),
message: {
subject: webhook.get("subject"),
from_email: "example@mail.com",
from_name: "System",
to: userData
},
async: false
}
},{
success: function(httpResponse) {
console.log(httpResponse);
},
error: function(error){
console.log(error);
}
});
});
您已将选项对象分成两个单独的对象:
Parse.Cloud.httpRequest({
method: 'POST',
headers: {
'Content-Type': 'application/json; charset=utf-8'
},
url: 'https://mandrillapp.com/api/1.0/messages/send-template.json',
body: {
template_name: webhook.get("mandrillTemplateSlug"),
template_content: null,
key: user.get("apiKey"),
message: {
subject: webhook.get("subject"),
from_email: "example@mail.com",
from_name: "System",
to: userData
},
async: false
}
}, { // <=== Remove these, replace with just a comma
success: function(httpResponse) {
console.log(httpResponse);
},
error: function(error) {
console.log(error);
}
});
应该只有一个,像这样:
Parse.Cloud.httpRequest({
method: 'POST',
headers: {
'Content-Type': 'application/json; charset=utf-8'
},
url: 'https://mandrillapp.com/api/1.0/messages/send-template.json',
body: {
template_name: webhook.get("mandrillTemplateSlug"),
template_content: null,
key: user.get("apiKey"),
message: {
subject: webhook.get("subject"),
from_email: "example@mail.com",
from_name: "System",
to: userData
},
async: false
},
success: function(httpResponse) {
console.log(httpResponse);
},
error: function(error) {
console.log(error);
}
});