Parse.com plugin v2

Just got a really bad announcement from Parse, they are shutting down the service in one year.

We have a difficult announcement to make. Beginning today we’re winding down the Parse service, and Parse will be fully retired after a year-long period ending on  January 28, 2017. We’re proud that we’ve been able to help so many of you build great mobile apps, but we need to focus our resources elsewhere.

We understand that this won’t be an easy transition, and we’re working hard to make this process as easy as possible. We are committed to maintaining the backend service during the sunset period, and are providing several tools to help migrate applications to other services.

First, we’re releasing a database migration tool that lets you migrate data from your Parse app to any MongoDB database. During this migration, the Parse API will continue to operate as usual based on your new database, so this can happen without downtime. Second, we’re releasing the open source Parse Server, which lets you run most of the Parse API from your own Node.js server. Once you have your data in your own database, Parse Server lets you keep your application running without major changes in the client-side code. For more details, check out our migration guide here.

We know that many of you have come to rely on Parse, and we are striving to make this transition as straightforward as possible. We enjoyed working with each of you, and we have deep admiration for the things you’ve built. Thank you for using Parse.

How ironic… Just as my first tests showed that everything was working fine with develephant’s clarification above.

Well, I guess we just have to start looking for another backend to migrate to…

By the way, thanks develephant! As I said in my previous post, your clarification above did the trick and it all seems to work.

Recently I deployed Parse-Server to Heroku and redirected my Corona client application to use that using the Parse plugin.

 

The queries work fine with no params. But once I add params they fail. A little debugging from Heroku logs show, that the path formed using the Parse plugin is different than when using curl or the mod_parse module:

 

with-plugin: 

path="/parse/classes/Category?order%3dname"

without-plugin (curl or mod_parse): 

path="/parse/classes/Category?order=name"

 

Using the plugin I get the error: 

{"error":"Invalid paramater for query: order=name","code":102}

 

Below is an example using the plugin:

 

local parse = require('plugin.parse') parse.config:cloudAddress("http://myappname.herokuapp.com/parse") parse.config:applicationId("myAppId") parse.request(parse.Object.query, "Category") :where({["is\_empty"] = false}) :options({ ["order"] = "name" }) :response(callback)

Here’s another interesting behavior…

When deleting a User object, the corresponding Session (revocable) object is not deleted automatically for some strange reason. If you delete the session manually first, the user can’t be deleted since you will get an “Invalid sessionToken” error (209). Same thing happens if you try to delete the user first and then the session. If you logout the user, the session is deleted but since User objects can only be modified (in this case deleted) while logged in, the user can’t be deleted like this either. If you try to ignore the zombie session altogether, you will get a 209 error when trying to create another user from the same device.

Is this a “Parse” feature/bug or a “Parse plugin” dito?

Hi,

I certainly won’t miss Parse (just kidding), but that is an interesting situation.

The only documentation I have found in regards to removing Sessions is via logging out the User.

My assumption is this is something you would need to write Parse cloud code to handle (via a Hook). There is a “master-key” that can delete anything without a session involved, but that’s not something you really want in your client code.

I’ll take a look as well to see if anything is obvious.

Cheers.

@develephant: first of all, thanks!

Logging out does indeed remove the session, but since the session is gone, it won’t let me delete the user. The alternative would be to not set the installationId (as described by you in your post January 19 above in this thread) but then the session table would start filling up pretty quick since new sessions would be created e.g. every time the app is restarted instead of existing ones re-used. Personally, I couldn’t care less, but a table with thousands or eventually even millions of rows must affect performance sooner or later.

I’ve read the Parse docs but it does not mention this anywhere, which I find extremely strange…

@develephant: any news on this issue? I’m kind of stuck here… Not being able to delete users is sort of a showstopper when submitting my app to AppStore.

Again, thanks for looking into this, really appreciate it!

I too am trying to migrate from Parse to a self hosted solution. However, it seems that parse plugin behaves differently when connected to the self hosted solution. For example, the code that should have created a new user on the DB now simply returns the list of existing users. Please advise.

Hi,

Just curious, what is the use case for deleting users? Are you allowing users to self-delete? Parse is very specific about not being able to make adjustments on a User account without some type of credentials (this is a common industry practice) or by using the “Master Key” (which you do not want to include in your app, because we are limited to the REST API).

What you are wanting to do may only be possible from Parse Cloud code (as mentioned previously), there is not really much I can do to change how Parse works, unfortunately.

As a side-note, you do know that Parse will not be available as a hosted service come end of year? Are you running your own open source Parse instance?

Cheers.

Hello,

Yes, I wanted to let the users delete themselves. Maybe it’s wrong but it seems user friendly to let the users delete their own account (personally, I don’t like it when I have to contact support to delete an account somewhere).

As long as the user is logged in, the necessary credentials are there, aren’t they? Or maybe deleting should be done by calling a cloud code function and delete the user from there? Then again, what is the use of “parse.User.delete” in the plugin API if Parse functionality does not allow it?

I know that Parse is about to shut down, but I’m following your good advice to stay calm and wait for the landscape of alternatives to become clear (e.g. Corona Cloud). In the mean time, I must make my existing apps work with the current solution, i.e. Parse…

Hi,

Hmm. So it makes sense that it should work if you’re allowing the user to delete their own account. I assume they are logged in at that time?

I think you’ll need to send off the user delete call first from Corona, and use Parse Cloud code to remove the session. https://parse.com/docs/cloudcode/guide#cloud-code-afterdelete-triggers

You won’t to need to do anything special for Parse to trigger the hook (except delete the user). That make sense?

Cheers.

I’d love to tell you that it worked, but alas…

I read the docs you referred to and used the following afterDelete trigger:

Parse.Cloud.afterDelete(Parse.User, function(request) { Parse.Cloud.useMasterKey(); query = new Parse.Query("Session"); query.equalTo("user", request.object); query.find({ success: function(sessions) { Parse.Object.destroyAll(sessions, { success: function() { console.log("Session deleted") }, error: function(error) { console.error("Error deleting related sessions " + error.code + ": " + error.message); } }); }, error: function(error) { console.error("Error finding related sessions " + error.code + ": " + error.message); } }); });

Notice the “Parse.Cloud.useMasterKey();” that I had to add for the function to execute without errors. I created a test user, deleted it and the the cloud code log said “Session deleted” (as per my console.log printout in the code) but the session was in fact NOT deleted. It was still there. In my face.

I’m really beginning to seriously dislike Parse.

Somehow this seems so strange. I mean, I can’t be the only Parse customer/victim who wants to delete a user? How do you guys do this? I’m starting to think I’m missing something on a more conceptual level here…

Hi develephant,

I understand you’re working on other projects now, but we rely on parse plug-in for past and hopefully future projects. If you can’t maintain the plug-in can you release its source to the community so we can continue its development? It was bad enough that FB decided to cut Parse off leaving us scrambling for alternatives and delaying our schedule by weeks. Just when we thought that we are past that obstacle, device testing shows additional quirks that were not there before.

Today I encountered yet another issue where the behavior is different between the cloud and Parse.com and I would have loved to debug the plug-in or simply review its code to identify the source of the problem.

Been blocked on this since the 9th of June, a little over a month now. Any word from the Corona staff on whether this will be addressed or dropped?

Regarding query with params, I’ve found out that using the original :options( params ) is not working. instead use :data( params )

I talked with @develephant and he said that the plugin is now open source and he’s not in a position to continue to support it. He made that announcement a while back. The Parse plugin was never a Corona Labs maintained product. We offer it through the store as a third-party created solution. If someone is interested in taking it over, it is open source. You could fix whatever and resubmit it and take ownership of supporting the plugin.

Rob

Thanks for the clarification @Rob, can you kindly link me to the open source Parse Plugin repo?

I’m not for sure, but here’s @develephant’s github: https://github.com/develephant?tab=repositories

I’ve looked both @develephant’s github and bitbucket, but I couldn’t find the repo for the Parse Plugin. Only a repo for the documentation of the Parse Plugin.

That’s why I’ve been a bit frustrated lately. If it’s open source, I’m completely fine with fixing issues and maintaining the plugin. If it’s not, and there won’t be any more updates, I’d like to know so that I can remove the plugin completely from my projects and move on.