Support Topics Documentation Slack YouTube Blog

Event Handler req.item object is incomplete

(Gabriel) #1

I have an event handler that have stopped working as of today. I did not change anything. I noticed that the problem is that it cannot read the property ‘channel’ from the req.item that is passed in the event handler.

In the code below, the event error out on the line
var channel =

Nothing changed since yesterday and this was working fine. You can test it be sending a REST CONSOLE B7F833A2-7B82-DECF-FF25-3555BC74F600 with this body:

My application ID is B7F833A2-7B82-DECF-FF25-3555BC74F600

“title”: “this is a test”,
“details”: “This is only a test”,
“category”: {
“___class”: “Category”,
“channel”: “Testing”

Backendless.ServerCode.Persistence.beforeCreate('Notification', function(req) {
  //add your code here
  var CategoryStore = Backendless.Data.of('Category');
  var channel =;
  var queryBuilder = Backendless.DataQueryBuilder.create()
    .setWhereClause("channel = '" + channel + "'")
    .setRelated( [ "parentCategory", "parentCategory.parentCategory" ] );

    return new Promise((resolve, reject) => {

        .then(categories => {
          if (categories.length == 0) {
            queryBuilder.setWhereClause("objectId = '09881500-C33F-04CA-FF04-AFA8CDA02700'")
            .then(categories => {
              req.context.crossHandlerData = { category: categories[0] };
            .catch(err => {
              reject('Could not get default Category. Error: ' + err.message);
        else {
          req.context.crossHandlerData = { category: categories[0] };
        .catch(err => {
        reject('Error retrieving category. Error: ' + err.message);

(Sergey Chupov) #2

Hi Gabriel,

Have you tried logging out req.item to see what it actually contains?

(Gabriel) #3

Yes, it has everything except the category sub object.

(Gabriel) #4

Notice that category is undefined! This was working yesterday and I did not change anything.

2017-11-30 18:29:55,710 | SERVER_CODE | INFO | Notification {
___class: ‘Notification’,
ownerId: undefined,
objectId: undefined,
created: undefined,
updated: undefined,
category: undefined,
title: ‘this is a test’,
details: ‘This is only a test’,
___jsonclass: ‘Notification’ }

(Sergey Chupov) #5

We found the problem, will be fixed in an hour approximately. Sorry for the inconvenience.

(Gabriel) #6

OK will check back in 1 hour to confirm.

(Sergey Chupov) #7

Works now, please verify.

(Gabriel) #8

It works. Thanks.