I am getting uncommitted work pending issue in my test class but Limits.getDMLStatements()
says there are 0 DML performed before and after callout. What else could cause this issue?
Code is running in Batch context inside
execute
method
try {
System.debug(Limits.getDMLStatements()); //log: 0
restclient.makeCallout(somedata);
}
catch(Exception ex){
System.debug(Limits.getDMLStatements()); //log: 0
System.debug(ex.getMessage()); //log: uncommitted work pending
}
NOTE: I am getting this issue in my packaging org but scratch org test are passing.