parse-community / Parse-SDK-JS

The JavaScript SDK for Parse Platform
https://parseplatform.org
Apache License 2.0
1.32k stars 598 forks source link

SDK gives stack overflow #324

Closed JustinDMoore closed 8 years ago

JustinDMoore commented 8 years ago

Before I go into the issue, can someone clarify something?

This repo shows the latest Parse Javascript SDK release to be 1.8.5 on May 12 However, this CDN link in the README.md shows 1.9.0

Which one is the current release that I should be using? Or maybe I am missing something.

The issue:

Parse JavaScript SDK v1.9.0 from CDN. Parse Server v2.2.16

Initialize

<script src="parse.min.js"></script>
<script>
    Parse.initialize("KEY");
    Parse.serverURL = 'URL'
</script>

Connect to Facebook:

window.fbAsyncInit = function() {
    Parse.FacebookUtils.init({
        appId      : 'ID',
        xfbml      : true,
        version    : 'v2.7'
    });
};

(function(d, s, id){
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) {return;}
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/en_US/sdk.js";
    fjs.parentNode.insertBefore(js, pjs);
}(document, 'script', 'facebook-jssdk'));

Get the current user: var user = Parse.User.current();

All fine up to this point. I can read and display from user.

When I try to update the user:

user.set("name", "test");
user.save();

parse.min.js RangeError: Maximum call stack size exceeded.

I checked for recursion. This is only being called one time. No idea why this error would be thrown. This occurred in both Parse Server .15 & .16

JustinDMoore commented 8 years ago

A note...

The following adds an InterstObject:

        var InterestObject = Parse.Object.extend("Interest");
        var intObj = new InterestObject();
        intObj.save({
            cadets: [checkCadets state],
            cadets2: [checkCadets2 state],
            cwp: [checkCWP state],
            cwg: [checkCWG state],
            question: [txtQuestion stringValue]
        }).then(function(object) {
            [viewSuccess setHidden: NO];
            [viewInterest setHidden: YES];
        });

As soon as I add the current user to the mix, it crashes with the same overflow error: (I did verify currentUser exists)

       var currentUser = Parse.User.current();
        var InterestObject = Parse.Object.extend("CadetsInterest");
        var intObj = new InterestObject();
        intObj.save({
            user: currentUser,
            cadets: [checkCadets state],
            cadets2: [checkCadets2 state],
            cwp: [checkCWP state],
            cwg: [checkCWG state],
            question: [txtQuestion stringValue]
        }).then(function(object) {
            [viewSuccess setHidden: NO];
            [viewInterest setHidden: YES];
        });

So. I'm wondering if I am just missing something. In cloud code, when updating the user object, you have to use the MasterKey. In my second example however, I am not updating the user. I am simply setting pointer in my InterestObject to the currentUser when I get the overflow.

andrewimm commented 8 years ago

Can you use an unminified version of the SDK, and provide a stack trace?

parse-github-bot commented 8 years ago

Thank you for your feedback. We prioritize issues that have clear and concise repro steps. Please see our Bug Reporting Guidelines about what information should be added to this issue.

Please try the latest SDK. Our release notes have details about what issues were fixed in each release.

In addition, you might find the following resources helpful:

parse-github-bot commented 8 years ago

This issue has not been updated for 7 days. If you have additional information to help pinpoint this issue as an SDK bug, please comment on this issue. We will close this issue in 7 days if no additional information is provided. Thank you for your feedback.