Skip to content

invalid key name: _noBody #448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ngjohn opened this issue Feb 16, 2016 · 12 comments · Fixed by #450
Closed

invalid key name: _noBody #448

ngjohn opened this issue Feb 16, 2016 · 12 comments · Fixed by #450
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@ngjohn
Copy link

ngjohn commented Feb 16, 2016

Hi,

I create an ParseObject in client side,
then, try to update the record using below code.

    ParseObject     record = ParseObject.CreateWithoutData("LockRecord", objectID);
    record.Increment("lock_count");
    Task run_task =   record.SaveAsync();

..

if(run_task.IsCanceled || run_task.IsFaulted)
{
// fail.....
}

the saveAsync() failed....

when I print out the exception msg, it said "invalid key name: _noBody"

this error happen after I host the server myself, it is not happened before~

Can someone give me some hints? Thanks a lot.

@gfosco
Copy link
Contributor

gfosco commented Feb 16, 2016

Can you check in your mongo database, do many of your LockRecord objects have a _noBody key on them?

@gfosco gfosco changed the title fail in SaveAsync() in doNet sdk invalid key name: _noBody Feb 16, 2016
@ngjohn
Copy link
Author

ngjohn commented Feb 16, 2016

Hi,

I just check the LockRecord table, no _noBody key was found~
they looks like this...

{
    "_id": "0OynPm0hnK",
    "attacker_id": "65lnd0hqMy",
    "defender_id": "zp2B6QvNuD",
    "lock_count": 3,
    "_created_at": {
        "$date": "2015-12-30T09:56:18.225Z"
    },
    "_updated_at": {
        "$date": "2015-12-30T10:01:47.704Z"
    }
}

For your information, this database is migrated from my existing Parse's DB. using the 'migrate' button...
after migration, i found lot of strange Collection such as _dummy, _Index, _EventDimension....

this problem is the first-time happened to me (after self-host), and I am new to mongodb)
I really dun know what is the reason~

Also, the SaveAsync() fail issues happened on ParseUser as well, when I try to update a _User field from the client code.

Thanks.

@gfosco
Copy link
Contributor

gfosco commented Feb 16, 2016

Ok, looks like the dot net SDK sets this field and we're choking on it... https://github.com/ParsePlatform/Parse-SDK-dotNET/search?utf8=%E2%9C%93&q=_noBody

Valid bug, will work on a PR.

@gfosco gfosco added the type:bug Impaired feature or lacking behavior that is likely assumed label Feb 16, 2016
@ngjohn
Copy link
Author

ngjohn commented Feb 18, 2016

Hi,

I just updated the parse-server to v2.1.0,
and I run a test on [Unity] the SaveAsync()... I got the same _noBody result.
do i miss something? or other package I need to update as well...?

I confirmed that the parse-server is v2.1.0.
and node is v4.3

Thanks a lot.

@drew-gross
Copy link
Contributor

No, 2.1.0 was supposed to supposed to fix this issue. We'll take a look. If you want to help, you could submit a PR that includes a failing test case :)

@drew-gross drew-gross reopened this Feb 18, 2016
@ngjohn
Copy link
Author

ngjohn commented Feb 18, 2016

Hi, gross,

I do want to help, can I submit a PR with code snippet in c# ? because I am developing on Unity c# .

currently, I am quite sure that this is ONLY happened in Unity ( Not in VS dotNet project)

:)

@drew-gross
Copy link
Contributor

Currently our test setup is only JavaScript, sorry :( the Unity SDK is the only one uses the _noBody key so it would be the only one that fails. If you don't want to write JavaScript, another way to help would be to capture a failing network request as a CURL command (or similar) and post that here. Unfortunately I don't know how to do that in Unity, but I searched for some tools, it seems like this one might help: http://www.telerik.com/fiddler

@gfosco
Copy link
Contributor

gfosco commented Feb 18, 2016

If the previous fix didn't work (removing _noBody from the request.body,) it's possible that this option is being passed as the request.query string... If you add some a console.log statement to print these out and make a few requests, you might be able to pinpoint the issue.

@ngjohn
Copy link
Author

ngjohn commented Feb 19, 2016

HI,
I try to remove the _noBody, and confirmed it is Ok ( I just make several create, update , query request to the server...)

 var parsed = Json.Parse(t.Result) as IDictionary<string, object>;
          // Inject the method
          parsed["_method"] = httpRequest.Method;
          //parsed["_noBody"] = noBody;    // fix _noBody bug.....( #448 )
          bytes = UTF8Encoding.UTF8.GetBytes(Json.Encode(parsed));

https://github.com/ParsePlatform/Parse-SDK-dotNET/search?utf8=%E2%9C%93&q=_noBody

I will keep checking for any side-effect of removing the _noBody key.

Hope this help some other Unity developer.

@flovilmart
Copy link
Contributor

@gfosco this is actually for non POST methods: https://github.com/ParsePlatform/Parse-SDK-dotNET/blob/f577ee38a0d55a199a473065b18acad084e4b083/ParseCommon/Internal/HttpClient/Unity/HttpClient.Unity.cs#L43

if (!httpRequest.Method.Equals("POST") || httpRequest.Data == null) { 

@ngjohn
Copy link
Author

ngjohn commented Feb 21, 2016

Yes, I found that 'update' & 'delete' object will use PUT methods....
and this will inject a '_noBody' in the request.

@gfosco
Copy link
Contributor

gfosco commented Feb 26, 2016

Assuming that #512 corrected things in 2.1.3. Please re-open if not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants