6 ms·
Parse Launches Cloud Code to Run Custom Code for Your App
- deleted 14y ago[deleted]
- saurik 14y agoNo: this is more about being able to define middleware that allows you to process information that would either be too costly to transfer to one of the clients or which is too sensitive to be trusted to a client.
- msie 14y agoFinally! I can run server code! I just might take another look at them now! Edit: Huh? Why was this downvoted? The problem I've had with Parse for a long time was that I still needed a separate server to do some backend processing that was not feasible to do on a client. Now I may no longer have need for that server.
- frankdenbow 14y agoMy thoughts exactly! This makes it much more appealing to me now. If they add in some helpers for Core Data I would be even more excited to try it.
- alexchamberlain 14y agoHow do they secure this?
- lacker 14y agoThe environment is based on V8, which provides a lot of tools to sandbox javascript code. There's some other pretty cool technology there - we might write a more detailed blog post about it if folks are interested.
- tlack 14y agoI would love to read that. Having a strong sandbox as a tool makes all kinds of interest things possible. p.s. My last name is Lackner. Glad to meet someone else with the unfortunate Lack- prefix.
- lacker 14y agoUnfortunate? Psh. When I was a little kid I liked "Lacker" because it rhymes with "Hacker". Then I grew up and became a computer programmer. See also: http://en.wikipedia.org/wiki/Nominative_determinism http://en.wikipedia.org/wiki/Nominative_determinism
- fictorial 14y agoIn late 2009, I had an idea to create a service that would allow game developers to run JavaScript on the server to drive multiplayer games. I worked on it for about 6 months and then Apple released Game Center. It was pretty clear that my service would be eclipsed by Game Center so I threw in the towel on it. At the time, I was targeting Node.js on the server and wrote a fledgling sand-boxing tool called Jefe [1]. I'm using Parse in my current app (Lexatron [2]) and I'm loving it. I'm looking forward to see what I can run on the server side. Full circle! [1] https://github.com/fictorial/jefe https://github.com/fictorial/jefe [2] http://fictorial.com/lexatron/ http://fictorial.com/lexatron/
- equark 14y agoThis would be very interesting to lots of people. There are lots of half-baked sandbox solutions so seeing what you guys did you be interesting.
- pyrotechnick 14y agoIs it node.js?
- lacker 14y agoNo. It is built on V8 directly, adding C++ hooks for extra functionality.
- julianpye 14y agoThis is great! And perfect timing! Just today I was starting to write a set of external hosted scripts to generate XML from my Parse objects, but this makes everything much easier. Parse is just terrific!
- nbclark 14y agoThis is great, but not quite what I had hope for. Yes you can run custom code, but only what their current API allows. It just saves time by not having to transfer data to the client to aggregate. Step in the right direction though.
- scottfr 14y agoThis looks great and should solve a number of issues with the current API. I have an app that basically tracks donations for different campaigns. Getting total donations per campaign isn't easy with the current API. There is nothing like a "select sum()" statement in Parse. Basically I currently have to run a cron job on my machine that will periodically download all donations by campaign and update the total donations field on the campaign (the regular user account doesn't have privileges to edit the campaign object). This seems like it will be a much cleaner, saner way to take care of this type of task.
- amirhirsch 14y agohow is this priced? a cloud code request probably can't fit within the pricing model posted on the parse site as a single API request because it may presumably have huge variance in resource consumption. like what's to stop someone from use parse's resources to run bitcoin miners?
- TazeTSchnitzel 14y agoIt looks to me like these are going to be short-running, on-request computations, that might timeout. Not long-running back-end code. Edit: Confirmed! https://news.ycombinator.com/item?id=4506783 https://news.ycombinator.com/item?id=4506783
- sunnynagra 14y agoHow does this effect the current pricing structure?
- juanbyrge 14y agoSweet! Parse is one step closer to being as powerful as my dream host vps was 10 years ago! Congrats guys!
- jordibunster 14y agoI assume there're execution limits to avoid while(true) {}. Can't seem to find information on that though.
- lacker 14y agoYes, each request is limited to a few seconds. We should make that more clear in the documentation - thanks for the feedback.
- facorreia 14y agoIt seems to make sense. Looks similar to the way Windows Azure Mobile Services lets you run JavaScript code on the server. http://weblogs.asp.net/scottgu/archive/2012/08/28/announcing-windows-azure-mobile-services.aspx http://weblogs.asp.net/scottgu/archive/2012/08/28/announcing...
- Ranma 14y agoCloudMine has supported this for months, and also supports Java code in addition to JavaScript.
- adelevie 14y agoThis looks incredible. I've been wanting a clean way to select multiple random objects from my Parse db. Until now, this was the best answer: https://parse.com/questions/random-search-its-possibile https://parse.com/questions/random-search-its-possibile. Also, it seems possible to combine this with IronWorker. You could create a worker in Ruby, then in the Parse Cloud Code, call that worker's endpoint. Something like this (rough sketch): worker.rb: require "some_ruby_email_gem" cgi_parsed = CGI::parse(payload) email = payload["email"] SomeRubyEmailGem.send(email, "Welcome, #{email}!") upload.rb: require 'iron_worker_ng' client = IronWorkerNG::Client.new(:token => config['iw']['token'], :project_id => config['iw']['project_id']) code = IronWorkerNG::Code::Ruby.new code.merge_worker 'worker.rb' code.merge_gem "some_ruby_email_gem" client.codes.create(code) url = "https://worker-aws-us-east-1.iron.io/2/projects/#{config['iw']['project_id']}/tasks/webhook?code_name=#{code.name}&oauth=#{config['iw']['token']}" puts "Add this url to to your Parse Cloud Code:" puts url Parse Cloud Code: Parse.Cloud.define("welcome, function(request, response) { var user = request.object.get("user"); var url = "https://worker-aws-us-east-1.iron.io/2..." // the url from upload.rb http.open("POST", url+"?email="+user.email, true); }); EDIT: HTTP requests to 3rd parties within Cloud Code are not possible yet, but Parse will add the feature soon. (http://twitter.com/ParseIt/status/245584646686003200 http://twitter.com/ParseIt/status/245584646686003200)
- thedangler 14y agoYeah! I requested this when I first started using parse a long time ago. I'm so happy that I can now implement hooks for syncing other db's.
- aherlambang 14y agoThis definitely lifts off the cons I've had so far with Parse, adding logic to the backend instead of just a pure data storage. Awesome job to the Parse team
- deleted 14y ago[deleted]
- pbreit 14y agoIt seems like Parse will be in a never-ending battle to continue adding functionality on the back-end to approach what one gets when they simply run their own back-end. Surely there is a happier medium?
- qhoxie 14y agoI think Cloud Code is a good example of why this is not the case. The more flexibility and customization they allow in the platform, the fewer long tail features they need to implement because people will be able to do it themselves.
- saurik 14y agoI imagine the argument is "once you add Cloud Code and people start using it to solve problems, you have pretty much re-built Google App Engine"; it means the only thing that separates Parse/StackMob/CloudMine (which now all have this feature) is that they come with a simple default app which provides an HTTP API to the data store that is used by an even simpler client library.
- mariusandreiana 14y agoExcept Parse is much more usable and more productive than AppEngine for regular folks who build mobile and web apps.
- saurik 14y agoRight, because they provide the two things I stated: a default app on the other side that provides fairly liberal access to your schema, and a library that can be used on the client that provides a fairly reasonable API (maybe even CoreData integration; I know some of their competitors do this) to access that API. Neither of these, however, are that complex to do, and the value of both of these drops dramatically once you start writing server-side logic in Java.
- lacker 14y ago
- jawngee 14y agoThis is great news. I've been using parse on a project and was missing this functionality. As a side note, I'm loving parse, but their iOS SDK is poorly designed. Like really badly designed. I had a few email exchanges with one of their devs, but it didn't really seem to go anywhere. You can't create subclasses of any of their objects because they like using static methods versus singleton instances. It's really stupid and it really ties you to using parse. You also have shit like this everywhere: NSString *someval=[pfobject objectForKey:@"shit"]; Where this would be preferred: NSString *someval=mySubclass.shit; So you can create a wrapper/shim for PFObject, but that doesn't float across queries returning arrays of objects. And, yes, I considered writing my own wrapper around their REST API but I don't have that kind of time.
- lacker 14y agoHelping subclassing to work more smoothly is definitely on our minds. A lot of people do subclass PFObject right now, and as you point out that means you need to handle queries in a slightly different way. It could be nicer, though, and we intend to make it nicer.
- don_draper 14y agoHow is it everyone's opinion of PaaS went sour when Google AppEngine readjusted its pricing to reflect costs. Now someone else comes along and PaaS is the greatest thing since sliced bread. These guys will never be bought by a bigger company with nothing but profits in mind?
- lucian1900 14y agoI wish them luck securing that. Even app engine had security trouble at first :)
- majorapps 14y agoWhat now is an API call that counts towards your quota? An API call to the Cloud Code from the client, or each call to a Parse method within the Cloud SDK?
- lacker 14y agoEach of these counts as an API call. It's a good question - we should make this more clear in our documentation.
- millerm 14y agoIs there any mechanism for specifying the HTTP method or is every function mapped to POST? I'm not complaining, I'm just curious.
- densone 14y agoDoes parse talk about how they run their backend? I feel like it's a lot of mongodb...
- sargun 14y agoThey use MongoDB, and MySQL. This worries me immensely. The Mongo part more than MySQL, only because historically, MongoDB has not had a great story around HA, and reliability...
- densone 14y agoDoes parse talk about how they run their backend? I feel like it's a lot of mongodb...
- deepGem 14y agoThis is good news. I had to move away from Parse just because I had to do some computation at the backend. Will try out the new feature.