Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Parse.com plugin v2
Started by Develephant Oct 24 2015 08:58 AM

- - - - -
70 replies to this topic
parse cloud coronium api develephant users database
[TOPIC CONTROLS]
Page 3 of 3 1 2 3
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#51

Divergent Monkey

[GLOBAL: userInfoPane.html]
Divergent Monkey
  • Contributor

  • 306 posts
  • Corona SDK

@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...



[TOPIC: post.html]
#52

Divergent Monkey

[GLOBAL: userInfoPane.html]
Divergent Monkey
  • Contributor

  • 306 posts
  • Corona SDK

@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!



[TOPIC: post.html]
#53

Develephant

[GLOBAL: userInfoPane.html]
Develephant
  • Corona Geek

  • 1,450 posts
  • Corona SDK

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.



[TOPIC: post.html]
#54

Divergent Monkey

[GLOBAL: userInfoPane.html]
Divergent Monkey
  • Contributor

  • 306 posts
  • Corona SDK

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...



[TOPIC: post.html]
#55

Develephant

[GLOBAL: userInfoPane.html]
Develephant
  • Corona Geek

  • 1,450 posts
  • Corona SDK

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.



[TOPIC: post.html]
#56

Divergent Monkey

[GLOBAL: userInfoPane.html]
Divergent Monkey
  • Contributor

  • 306 posts
  • Corona SDK

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...



[TOPIC: post.html]
#57

Appduction Studios

[GLOBAL: userInfoPane.html]
Appduction Studios
  • Enthusiast

  • 36 posts
  • Corona SDK

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)


[TOPIC: post.html]
#58

rune7

[GLOBAL: userInfoPane.html]
rune7
  • Contributor

  • 364 posts
  • Corona SDK

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.



[TOPIC: post.html]
#59

rune7

[GLOBAL: userInfoPane.html]
rune7
  • Contributor

  • 364 posts
  • Corona SDK

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.



[TOPIC: post.html]
#60

Appduction Studios

[GLOBAL: userInfoPane.html]
Appduction Studios
  • Enthusiast

  • 36 posts
  • Corona SDK

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?



[TOPIC: post.html]
#61

rune7

[GLOBAL: userInfoPane.html]
rune7
  • Contributor

  • 364 posts
  • Corona SDK

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



[TOPIC: post.html]
#62

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,779 posts
  • Enterprise

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



[TOPIC: post.html]
#63

Appduction Studios

[GLOBAL: userInfoPane.html]
Appduction Studios
  • Enthusiast

  • 36 posts
  • Corona SDK

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



[TOPIC: post.html]
#64

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,779 posts
  • Enterprise

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



[TOPIC: post.html]
#65

Appduction Studios

[GLOBAL: userInfoPane.html]
Appduction Studios
  • Enthusiast

  • 36 posts
  • Corona SDK

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. 



[TOPIC: post.html]
#66

rune7

[GLOBAL: userInfoPane.html]
rune7
  • Contributor

  • 364 posts
  • Corona SDK

I've looked as well and could not find the source there. Please advise.



[TOPIC: post.html]
#67

Develephant

[GLOBAL: userInfoPane.html]
Develephant
  • Corona Geek

  • 1,450 posts
  • Corona SDK

Hi folks,

 

First, my apologies for the unclarity. I think one issue is that I worked on a lot of these projects before I was hired on at Corona. As such, I now have assigned tasks that I must prioritize. Previously I could work on whatever, whenever, but that is no longer the case.

 

In regards to the Parse plugin, Corona itself has no responsibility to update it or even host it. It is/was a personal project.

 

With that in mind, I have opened up the repo publicly (I totally forgot to set it public when I talked with Rob).

 

Please note that this is a Corona "plugin" and not just a drop-in module. As such you should be familiar with how plugins are structured, and built: https://docs.coronalabs.com/native/plugin/index.html#lua-only

 

If anyone wants to maintain the project, I'll be more than happy to add serious contributors. The actual distributed plugin can only be compiled from the main repo.

 

And without further ado (whatever that means): https://bitbucket.org/develephant/corona-plugin-parse

 

Additionally, if you feel this is an important plugin, then please make sure the upper staff know that. I don't make those decisions.

 

Again, sorry for the miscommunication. It's possibly sleep related (or lack of).   ;)

 

Cheers.



[TOPIC: post.html]
#68

Appduction Studios

[GLOBAL: userInfoPane.html]
Appduction Studios
  • Enthusiast

  • 36 posts
  • Corona SDK

Hi Chris,

Thanks for making the repo public. We've been using a temporary wrapper we've made, but now we can start reverting back to your plugin and start fixing the issues we've been facing.

Expect a pull request in the near future.

Cheers,
Shehab



[TOPIC: post.html]
#69

Develephant

[GLOBAL: userInfoPane.html]
Develephant
  • Corona Geek

  • 1,450 posts
  • Corona SDK

Hi Shehab,

 

I got your recent fix, thank you very much! I'm sure you've made the community happy as well. :)

 

The latest "plugin" should compile and deploy over the next few hours or so.

 

Cheers.



[TOPIC: post.html]
#70

Appduction Studios

[GLOBAL: userInfoPane.html]
Appduction Studios
  • Enthusiast

  • 36 posts
  • Corona SDK

Hi @Rob,

Small question, is it possible that plugins get built with old code? Currently when I clone the parse plugin repo and test locally, everything works like a charm. But when I let the simulator download it, it still crashes on the same old error.

What do you think could be causing this?



[TOPIC: post.html]
#71

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,779 posts
  • Enterprise

The plugin would have to be updated on our server before the simulator could download it. I don't know if this plugin has been updated on our servers recently or not.




[topic_controls]
Page 3 of 3 1 2 3
 
[/topic_controls]