-
-
Notifications
You must be signed in to change notification settings - Fork 739
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
Unable to parse createdAt and updatedAt fields when parse object sent as response from cloud code method #130
Comments
Thanks for your detailed report! We've determined this is a bug in the latest JS SDK and are working on a fix. The best workaround would be to revert to |
@andrewi Since JS isn't open sourced yet, mind being the assignee of this issue? |
Resolved in the JS SDK codebase. I will attempt to release 1.6.2 today after a few more bugfixes. @aceankur once the new version of the JS SDK has been released, you can update which version your cloud code uses in your |
Thanks @andrewimm. That was prompt. |
@andrewimm you wrote that this bug had been resolved in release 1.6.2. But it isn't resolved now. Date in respons is still in UTC format. |
@MariaKulkova can you be more specific about your issue? The response should be in UTC format, but it should be a string. @aceankur 1.6.2 was deployed last night, update your |
@andrewimm First of all, I'm sorry, I realized that the bug which was discussed in this theme doesn't completely match to my bug. But my bug is still isn't resolved. |
Closing this since the original issue has been resolved in the JS SDK release 1.6.2. @MariaKulkova If you're still having issues, I recommend moving this conversation to the Parse-SDK-JS repository. |
this is still not working for me. I am on JS SDK 1.6.2 and Android SDK 1.10.2 and i get the "getTime() on null object reference" error every time I call my cloud code function. Response format hasn't changed from @aceankur's original post: "createdAt":{"__type":"Date","iso":"2015-09-24T09:39:21.972Z"}, seems like Android SDK is expecting "createdAt":"2015-09-24T09:39:21.972Z". |
@d370urn3ur I am still sticking with 1.5.0 SDK and have not verified the fix. This issue has been marked as closed. I suggest that you either get it reopened or create a new one to get visibility with parse developers. |
Anyway we can reopen this issue and have Android support both the string and hash version of Dates? Both the string and hash version of createdAt and updatedAt is supported in the iOS SDK and it is a bit inconsistent to have Date columns return hash versions while createdAt and updatedAt return strings. We are working on our cloud code webhooks server (that runs our cloud functions), and would be great to use the new common format across all platforms. Thanks! |
@apersaud We won't be reopening this issue since you're feature request is a bit different than the original bug report. RE supporting JSON date formats in created/updatedAt: I'm not sure something like this would be necessary, since you shouldn't be modifying these values before the client receives them. If you're still interesting in pursuing this, I'd recommend opening a new issue. |
I've got the error here trying to cache an object. If you do const cacheString = JSON.stringify(parseObject.toJSON());
const obj = new Parse.Object.Extend('Player');
obj.set(JSON.parse(cacheString));
console.log(obj.toJSON()); you will see that the createdAt and updatedAt is not set properly.
|
This is specific to how android sdk is parsing the response from cloud code deployed by latest jssdk (1.6.0)
We have written a cloud code method which takes an id, creates an object and returns it. The response has createdAt is a json object with iso and type props:
We get a
java.text.ParseException
in callback for callFunctionInBackground method. When we switch parse jssdk to 1.5.0 and redeploy, this exception goes away in the Android code.RCA from our end:
Since
"__type": "Object"
in the result, ParseDecoder.java calls fromJSON for the entire object, and ParseDateFormat receives{ "__type": "Date", "iso": "2015-09-13T12:45:14.656Z" }
which it is unable to parse and throws the exception.After changing jssdk to 1.5.0, createdAt in the response from server was:
"createdAt": "2015-09-13T12:45:14.656Z"
(note: not a nested object anymore) and ParseDateFormat was able to parse this to a valid Date object.The text was updated successfully, but these errors were encountered: