Unable to perform update when adding new menu field I'm attempting to add a custom image field to my menu from a custom module like so

function my_module_entity_base_field_info(EntityTypeInterface $entity_type) {
  $fields = array();
      if ($entity_type-&gt;id() === 'menu_link_content') {
          $fields['menu_link_secondary_image'] = BaseFieldDefinition::create('image')
              -&gt;setLabel(t('Menu link secondary image'))
              -&gt;setDescription(t('Upload a secondary image related to this menu item'))
              -&gt;setDisplayOptions('form',array('type' =&gt; 'image','weight' =&gt; 1))
              -&gt;setDisplayConfigurable('form',TRUE)
          -&gt;setSettings([
              'file_directory' =&gt; 'public://',
              'alt_field_required' =&gt; 'FALSE',
              'file_extensions' =&gt; 'png jpg jpeg',
          ]);

      return $fields;
    }
}


Then in my update function I have 

function my_module_update_8001(){
    $entity_manager = \Drupal::entityManager();
    $definitions = $entity_manager-&gt;getLastInstallFieldStorageDefinitions('menu_link_content');
    if(!isset($definitions['menu_link_secondary_image']) || empty($definitions['menu_link_secondary_image'])){
        $definition = $entity_manager-&gt;getFieldStorageDefinitions('menu_link_content')['menu_link_secondary_image'];
        $entity_manager-&gt;onFieldStorageDefinitionCreate($definition);
    }
}


But when I attempt to run update.php it hangs and I get errors like 


  Notice: Undefined index: menu_link_secondary_image__alt in
  Drupal\Core\Entity\Sql\SqlContentEntityStorage->loadFromSharedTables()


Strangely enough I added a menu link afterwards and my field was actually there. I couldn't tell if my update actually worked and just didn't act as if it did, or if it already worked before hand and the update was unnecessary. Did I do something wrong? 

UPDATE: I see that although my field appeared I'm unable to save it due to this error


  Column not found: 1054 Unknown column
  'menu_link_secondary_image__target_id' i
Just update entities it will work: run the command drush entity-updates.
No need for hook_update_N.
You can add hook_install to update entities automatically when you install your module don't need to do it by command each time or get the error on every installation .  



/**
 * Implements hook_install().
 */
function my_module_install() {
  \Drupal::service('entity.definition_update_manager')->applyUpdates();
}