afterCreate: Duplicate entry

We started receiving these errors starting around 3AM pacific time today. We haven’t made any modifications to the server code and it started giving “Duplicate entry” error messages and none of my table item got created.

Did something change on Backendless?

Thanks,

Here is the server code. It hasn’t been touched and was working fine until this morning.

@Asset( "Notification" )
public class NotificationTableEventHandler extends com.backendless.servercode.extension.PersistenceExtender<Notification>
{
  @Override
  public void beforeCreate( RunnerContext context, Notification notification) throws Exception {

    System.out.println("before create");
    Category category = notification.getCategory();

    if (category != null && category.getObjectId() == null) {
      String channel = category.getChannel();
      BackendlessDataQuery dataQuery = new BackendlessDataQuery();
      dataQuery.setWhereClause("channel = '" + channel + "'");
      BackendlessCollection<Category> result = Backendless.Persistence.of(Category.class).find(dataQuery);
      List<Category> categories = result.getCurrentPage();
      if (categories.isEmpty()) {
        category = Backendless.Persistence.of(Category.class).findById("09881500-C33F-04CA-FF04-AFA8CDA02700");
        String title = notification.getTitle();
        notification.setTitle("[Channel Not Found: " + channel + "] " + title);
        System.out.println("Category not found, setting it to apps_notifyr_push_err");
      }
      else {
        category = categories.get(0);
        System.out.println("Found category: " + category.getObjectId());
      }
      notification.setCategory(category);
    }


  }

  @Override
  public void afterCreate( RunnerContext context, Notification notification, ExecutionResult<Notification> result ) throws Exception
  {

    System.out.println("after create!");

    String channel = "apps_notifyr_servercode_err";
    String title;

    ExceptionWrapper ex = result.getException();
    if (ex != null) {
      System.out.println("Exception: " + ex.getExceptionMessage());
      title = "afterCreate(Notification) : " + ex.getExceptionMessage();
    }
    else {
      Category category = notification.getCategory();
      channel = category.getChannel();
      title = notification.getTitle();
    }

    DeliveryOptions deliveryOptions = new DeliveryOptions();
    deliveryOptions.setPushPolicy(PushPolicyEnum.ONLY);


    PublishOptions publishOptions = new PublishOptions();
    publishOptions.putHeader("ios-alert", title);
    publishOptions.putHeader("ios-sound", "default");
    publishOptions.putHeader("n", notification.getObjectId());


    MessageStatus status = Backendless.Messaging.publish(channel, title, publishOptions, deliveryOptions);

    System.out.println(status.toString());

  }
    
}

What is your application id?