'Get Email when user edit the specific column

Can you help check why im getting this error?

TypeError: Cannot read property 'source' of undefined



function onEdit(e) {
var s = e.source.getActiveSheet();
if( s.getName() == "TEST" ) { //checks that we're on the correct sheet
  var r = e.range;
  if( r.getColumn() == 4 ) { //checks the column for HUB side
    var nextCell = r.offset(0, 1);
    if( nextCell.getValue() === '' ) //is empty?
      nextCell.setValue(Session.getActiveUser().getEmail());
  }
  
}
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source