Cloud code acts as if not changed

2 posts, 0 answers
  1. Adrian
    Adrian avatar
    1 posts
    Member since:
    Apr 2011

    Posted 17 Sep 2014 Link to this post

    Hi, 

    i created some backend rules for one of my types. They worked fine, and i wanted to add another (blindly, because debugging doesn't work)

    the app didn't do what i wanted but it didn't crash either.

    5 hours later it starts givving me a message which i instantly recognize that it's the backend code.Strange, i think, i did this many hours ago.

    I removed the code, still the error persists, as if I didn't change the code.



    As a sidenote, I was trying to create a mechanism on aftercreate to create a record for another type at the same time.

    Something along the lines of

    var library = Everlive.Sdk.$.data('Library');
    var element={};
    element.CreatedId=param.CreatedId;
    library.create(element);



    some suggestions would be great for this also

    Thank you.
  2. Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 18 Sep 2014 Link to this post

    Hello Adrian,

    The problem you have encountered is certainly an unexpected behavior of our Cloud Code and Debugging services. We have no reported incidents with our infrastructure and everything should be up and running.

    Could you please elaborate on the issue you have experienced? You mentioned some errors returned by the server - were they system errors or returned from the custom code?

    Also, we would like to know which part the debugging is not working: starting a debug session, hitting breakpoints, etc.? You can read more about this feature in Interactive Debugging.

    Some of the common guidelines for troubleshooting include:
    • Verify that the done() function is invoked when you code is completed.
    • Verify that you Save the changes in the cloud code canvas.
    • Verify that you adhere to the events' natural order - a complex code can easily enter an infinite loop between events of different content types.
    • Verify that you are starting your debug session in Chrome. It will not start in other browsers.
    • Verify that you are sending a X-Everlive-Debug: true header for the requests that you would like to debug and a debug session is started.
    In regard to your second question. You can easily achieve this with the JavaScript SDK of the Cloud code.
    Everlive.Events.afterCreate(function(request, response, context, done) {
        if (response.statusCode === 201) { // success, the parent item is created
            var createdItemId = response.result.Id;
     
            var newObject = {
                "myParentId": createdItemId
            };
     
            Everlive.Sdk.$.data('ChildContentType').create(newObject,                             function(data) {
                    console.log(data);
                }, function(err) {
                    console.log(err);
                });
                done();
        } else {
            done();
        }
    });

    You can read more about this topic in the dedicated article in our documentation. Please note the Initialization part when the differences between the three types of initialization are explained.

    Let me know if you have questions.

    Regards,
    Anton Dobrev
    Telerik
     
    Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
     
Back to Top