我收到以下錯誤,當我嘗試創建一個客戶。我試着降級Parse。目前它運行的是最新的(2.2.8)版本,但我也嘗試過版本1.4.2,而且我仍然收到以下錯誤。什麼可能是這個「TypeError」的原因?類型錯誤:對象的翻譯:有沒有方法'
TypeError: Object [object Object] has no method 'isString'
at request (stripe.js 49:25) at post (stripe.js:117:12) at
Object.module.exports.Customers.create (stripe.js:239:16) at main.js:15:22
Main.js:
//STRIPE
var Stripe = require("stripe")
Stripe.initialize = ("sk_test_XXXXX");
Parse.Cloud.define("saveCustomerId", function(request, response) {
Parse.Cloud.useMasterKey();
Stripe.Customers.create({
card : request.params.token,
email: request.params.email,
description: request.params.description,
}, {
success : function(customer) {
var Usr = request.user;
var newcust = Parse.Object.extend("Customer");
var newUsr = new newcust();
newUsr.set("sCID", customer.id);
newUsr.set("parent", Usr);
var pACL = new Parse.ACL();
pACL.setPublicReadAccess(false);
pACL.setPublicWriteAccess(false);
pACL.setReadAccess(Usr, true);
pACL.setWriteAccess(Usr, true);
newUsr.set("ACL", pACL);
newUsr.save(null, {
success : function(customer) {
response.success("customer saved to parse = " + Usr.get("username"));
},
error : function(customer, error) {
response.error("Ops failed to saved customer id ");
}
});
},
error : function() {
response.error("Fejl");
}
});
});
感謝我試圖舊版本遺憾的是它並沒有幫助。我通過自己創建模塊來解決問題。 – ESG
我在版本1.6.14中遇到了這個問題。只要我回滾到1.5.0就行了。謝謝你 –