function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Hemant Gulati 4Hemant Gulati 4 

Getting internal server error issue in lightning app

I am getting this issue "An internal server error has occurred Error ID: 1854847182-41225 (-1177185898)" while inserting a record through lightninig app, as i am calling a Component function from helper file and passing an object(record) in it.

Helper file code:-  

createExpense: function(component, expense) {
       
        this.upsertExpense(component, expense, function(a) {
            var expenses = component.get("v.expenses");
            expenses.push(a.getReturnValue());
            component.set("v.expenses", expenses);
            this.updateTotal(component);
        });
    },
    upsertExpense : function(component, expense, callback) {
        console.log("Save");
        var action = component.get("c.saveExpense",expense);
        console.log("Save2");
        /*action.setParams({
            "expense": expense
        });*/
        if (callback) {
            action.setCallback(this, callback);
        }
        $A.enqueueAction(action);
    }


Controller file code:- 

public with sharing class ExpenseController {
    @AuraEnabled
    public static Expense__c saveExpense(Expense__c expense) {
        // Perform isUpdateable() check here
        System.debug('Upsert Start');
        upsert expense;
        System.debug('Upsert Done');
        return expense;
    }
  
    @AuraEnabled
    public static List<Expense__c> getExpenses() {
        // Perform isAccessible() check here
        return [SELECT Id, Name, Amount__c, Client__c, Date__c,
                Reimbursed__c, CreatedDate FROM Expense__c];
    }
    
}


getExpenses function is running correctly, but when i am calling saveExpense from helper file, it generates error.

Please help me.

Thanks,
Hemant Gulati