本文介绍了TypeError:对象[object Object]没有方法''的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试创建客户时出现以下错误.我尝试降级Parse.当前它正在运行最新的(2.2.8)版本,但是我也尝试了1.4.2版本,但是仍然出现以下错误.发生此"TypeError"的原因是什么?

I am getting the following error when I try to create a customer. I tried downgrading Parse. Currently it is running the latest(2.2.8) version but I tried version 1.4.2 too, and I am still getting the following error. What can be the reason for this "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");
        }
    });
});

推荐答案

这似乎是解析API错误,如果您回滚到Parse 1.3.5,则应该修复该错误.在终端(在Mac上)或控制台(在其他平台上)中输入

This looks to be a parse API bug, it should be fixed if you roll-back to Parse 1.3.5. In terminal (on mac) or console (on other platforms) type

解析jssdk 1.5.0

parse jssdk 1.5.0

这篇关于TypeError:对象[object Object]没有方法''的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-28 04:14