diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php
index 19ad14fca9..b8d71b4a08 100644
--- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php
+++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php
@@ -672,6 +672,21 @@ public function getFieldDefinition($name) {
     if (isset($this->fieldDefinitions[$name])) {
       return $this->fieldDefinitions[$name];
     }
+    else {
+      // It is possible that the entity does not have a field definition for a
+      // valid field because the field configuration exists, but no data has
+      // been stored for this entity, such as during a migration. This fetches
+      // the field definitions from the field manager directly rather to
+      // populate the field definitions stored on this object.
+      $definitions = \Drupal::service('entity_field.manager')
+        ->getFieldDefinitions($this->entityTypeId, $this->bundle());
+      if (isset($definitions[$name])) {
+        $this->fieldDefinitions[$name] = $definitions[$name];
+        return $this->fieldDefinitions[$name];
+      }
+    }
+
+    return NULL;
   }
 
   /**
diff --git a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateEmptyReferenceFieldTest.php b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateEmptyReferenceFieldTest.php
new file mode 100644
index 0000000000..fd4c6e5db5
--- /dev/null
+++ b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateEmptyReferenceFieldTest.php
@@ -0,0 +1,93 @@
+<?php
+
+namespace Drupal\Tests\field\Kernel\Migrate\d7;
+
+use Drupal\node\Entity\Node;
+use Drupal\Tests\migrate\Kernel\NodeCommentCombinationTrait;
+use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
+
+/**
+ * Tests migration of D7 entityreference field.
+ *
+ * @group field
+ */
+class MigrateEmptyReferenceFieldTest extends MigrateDrupal7TestBase {
+
+  use NodeCommentCombinationTrait;
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = [
+    'comment',
+    'datetime',
+    'entity_reference',
+    'file',
+    'filter',
+    'forum',
+    'image',
+    'link',
+    'node',
+    'menu_ui',
+    'system',
+    'taxonomy',
+    'telephone',
+    'text',
+  ];
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp();
+    $this->installEntitySchema('user');
+    $this->installEntitySchema('node');
+    $this->installEntitySchema('comment');
+    $this->installEntitySchema('comment_type');
+    $this->installEntitySchema('taxonomy_term');
+    $this->installEntitySchema('taxonomy_vocabulary');
+    $this->installSchema('comment', ['comment_entity_statistics']);
+    $this->installSchema('forum', ['forum_index', 'forum']);
+    $this->installSchema('node', ['node_access']);
+    $this->installConfig(static::$modules);
+    $this->executeMigrations([
+      'd7_filter_format',
+      'd7_user_role',
+      'd7_user',
+      'd7_node_type',
+      'd7_node',
+      'd7_comment_type',
+      'd7_comment_field',
+      'd7_comment_field_instance',
+      'd7_comment',
+      'd7_taxonomy_vocabulary',
+      'd7_taxonomy_term',
+      'd7_field',
+      'd7_field_instance',
+    ]);
+  }
+
+  /**
+   * Asserts that something is wrong with empty field instances on nodes.
+   */
+  public function testEmptyFields() {
+    // Asserts that field definition exists.
+    $definitions = $this->container
+      ->get('entity_field.manager')
+      ->getFieldDefinitions('node', 'article');
+    $this->assertArrayHasKey('field_reference_3', $definitions);
+
+    // Try to save on an article node that was migrated.
+    $node = Node::load(2);
+    try {
+      $node->set('field_reference_3', [5]);
+      $node->save();
+      $this->assertEquals(5, $node->field_reference_3->target_id);
+    }
+    catch (\InvalidArgumentException $e) {
+      // Asserts that the field definition is missing from the entity itself.
+      $this->assertArrayHasKey('field_reference_3', $node->getFieldDefinitions());
+    }
+  }
+
+}
diff --git a/core/modules/migrate_drupal/tests/fixtures/drupal7.php b/core/modules/migrate_drupal/tests/fixtures/drupal7.php
index 310fe3744f..e4d81d6b85 100644
--- a/core/modules/migrate_drupal/tests/fixtures/drupal7.php
+++ b/core/modules/migrate_drupal/tests/fixtures/drupal7.php
@@ -4191,6 +4191,21 @@
   'translatable' => '1',
   'deleted' => '0',
 ))
+->values(array(
+  'id' => '44',
+  'field_name' => 'field_reference_3',
+  'type' => 'entityreference',
+  'module' => 'entityreference',
+  'active' => '1',
+  'storage_type' => 'field_sql_storage',
+  'storage_module' => 'field_sql_storage',
+  'storage_active' => '1',
+  'locked' => '0',
+  'data' => 'a:7:{s:12:"translatable";s:1:"0";s:12:"entity_types";a:0:{}s:8:"settings";a:3:{s:11:"target_type";s:4:"node";s:7:"handler";s:4:"base";s:16:"handler_settings";a:2:{s:14:"target_bundles";a:1:{s:7:"article";s:7:"article";}s:4:"sort";a:1:{s:4:"type";s:4:"none";}}}s:7:"storage";a:5:{s:4:"type";s:17:"field_sql_storage";s:8:"settings";a:0:{}s:6:"module";s:17:"field_sql_storage";s:6:"active";s:1:"1";s:7:"details";a:1:{s:3:"sql";a:2:{s:18:"FIELD_LOAD_CURRENT";a:1:{s:28:"field_data_field_reference_3";a:1:{s:9:"target_id";s:27:"field_reference_3_target_id";}}s:19:"FIELD_LOAD_REVISION";a:1:{s:32:"field_revision_field_reference_3";a:1:{s:9:"target_id";s:27:"field_reference_3_target_id";}}}}}s:12:"foreign keys";a:1:{s:4:"node";a:2:{s:5:"table";s:4:"node";s:7:"columns";a:1:{s:9:"target_id";s:3:"nid";}}}s:7:"indexes";a:1:{s:9:"target_id";a:1:{i:0;s:9:"target_id";}}s:2:"id";s:2:"44";}',
+  'cardinality' => '1',
+  'translatable' => '0',
+  'deleted' => '0',
+))
 ->execute();
 $connection->schema()->createTable('field_config_instance', array(
   'fields' => array(
@@ -4871,6 +4886,24 @@
   'data' => 'a:6:{s:5:"label";s:7:"Subject";s:11:"description";s:0:"";s:8:"required";b:1;s:8:"settings";a:4:{s:15:"text_processing";i:0;s:10:"hide_label";a:2:{s:4:"page";b:0;s:6:"entity";b:0;}s:18:"user_register_form";b:0;s:23:"entity_translation_sync";b:0;}s:6:"widget";a:4:{s:6:"weight";i:-5;s:4:"type";s:14:"text_textfield";s:8:"settings";a:1:{s:4:"size";i:60;}s:6:"module";s:4:"text";}s:7:"display";a:1:{s:7:"default";a:4:{s:4:"type";s:6:"hidden";s:5:"label";s:5:"above";s:8:"settings";a:0:{}s:6:"weight";i:1;}}}',
   'deleted' => '0',
 ))
+->values(array(
+  'id' => '72',
+  'field_id' => '44',
+  'field_name' => 'field_reference_3',
+  'entity_type' => 'node',
+  'bundle' => 'article',
+  'data' => 'a:6:{s:5:"label";s:11:"Reference 3";s:6:"widget";a:4:{s:4:"type";s:14:"options_select";s:6:"weight";s:2:"21";s:8:"settings";a:0:{}s:6:"module";s:7:"options";}s:8:"settings";a:1:{s:18:"user_register_form";b:0;}s:7:"display";a:1:{s:7:"default";a:5:{s:5:"label";s:5:"above";s:4:"type";s:21:"entityreference_label";s:8:"settings";a:2:{s:4:"link";b:0;s:13:"bypass_access";b:0;}s:6:"module";s:15:"entityreference";s:6:"weight";i:21;}}s:8:"required";b:0;s:11:"description";s:0:"";}',
+  'deleted' => '0',
+))
+->values(array(
+  'id' => '73',
+  'field_id' => '44',
+  'field_name' => 'field_reference_3',
+  'entity_type' => 'node',
+  'bundle' => 'forum',
+  'data' => 'a:6:{s:5:"label";s:11:"Reference 3";s:6:"widget";a:4:{s:4:"type";s:14:"options_select";s:6:"weight";s:2:"21";s:8:"settings";a:0:{}s:6:"module";s:7:"options";}s:8:"settings";a:1:{s:18:"user_register_form";b:0;}s:7:"display";a:1:{s:7:"default";a:5:{s:5:"label";s:5:"above";s:4:"type";s:21:"entityreference_label";s:8:"settings";a:2:{s:4:"link";b:0;s:13:"bypass_access";b:0;}s:6:"module";s:15:"entityreference";s:6:"weight";i:21;}}s:8:"required";b:0;s:11:"description";s:0:"";}',
+  'deleted' => '0',
+))
 ->execute();
 $connection->schema()->createTable('field_data_body', array(
   'fields' => array(
@@ -9315,6 +9348,91 @@
   'title_field_format' => NULL,
 ))
 ->execute();
+
+$connection->schema()->createTable('field_data_field_reference_3', array(
+  'fields' => array(
+    'entity_type' => array(
+      'type' => 'varchar',
+      'not null' => TRUE,
+      'length' => '128',
+      'default' => '',
+    ),
+    'bundle' => array(
+      'type' => 'varchar',
+      'not null' => TRUE,
+      'length' => '128',
+      'default' => '',
+    ),
+    'deleted' => array(
+      'type' => 'int',
+      'not null' => TRUE,
+      'size' => 'tiny',
+      'default' => '0',
+    ),
+    'entity_id' => array(
+      'type' => 'int',
+      'not null' => TRUE,
+      'size' => 'normal',
+      'unsigned' => TRUE,
+    ),
+    'revision_id' => array(
+      'type' => 'int',
+      'not null' => FALSE,
+      'size' => 'normal',
+      'unsigned' => TRUE,
+    ),
+    'language' => array(
+      'type' => 'varchar',
+      'not null' => TRUE,
+      'length' => '32',
+      'default' => '',
+    ),
+    'delta' => array(
+      'type' => 'int',
+      'not null' => TRUE,
+      'size' => 'normal',
+      'unsigned' => TRUE,
+    ),
+    'field_reference_3_target_id' => array(
+      'type' => 'int',
+      'not null' => TRUE,
+      'size' => 'normal',
+      'unsigned' => TRUE,
+    ),
+  ),
+  'primary key' => array(
+    'entity_type',
+    'entity_id',
+    'deleted',
+    'delta',
+    'language',
+  ),
+  'indexes' => array(
+    'entity_type' => array(
+      'entity_type',
+    ),
+    'bundle' => array(
+      'bundle',
+    ),
+    'deleted' => array(
+      'deleted',
+    ),
+    'entity_id' => array(
+      'entity_id',
+    ),
+    'revision_id' => array(
+      'revision_id',
+    ),
+    'language' => array(
+      'language',
+    ),
+    'field_reference_3_target_id' => array(
+      'field_reference_3_target_id',
+    ),
+  ),
+  'mysql_character_set' => 'utf8',
+));
+
 $connection->schema()->createTable('field_revision_body', array(
   'fields' => array(
     'entity_type' => array(
@@ -13792,6 +13910,92 @@
   'title_field_format' => NULL,
 ))
 ->execute();
+
+$connection->schema()->createTable('field_revision_field_reference_3', array(
+  'fields' => array(
+    'entity_type' => array(
+      'type' => 'varchar',
+      'not null' => TRUE,
+      'length' => '128',
+      'default' => '',
+    ),
+    'bundle' => array(
+      'type' => 'varchar',
+      'not null' => TRUE,
+      'length' => '128',
+      'default' => '',
+    ),
+    'deleted' => array(
+      'type' => 'int',
+      'not null' => TRUE,
+      'size' => 'tiny',
+      'default' => '0',
+    ),
+    'entity_id' => array(
+      'type' => 'int',
+      'not null' => TRUE,
+      'size' => 'normal',
+      'unsigned' => TRUE,
+    ),
+    'revision_id' => array(
+      'type' => 'int',
+      'not null' => TRUE,
+      'size' => 'normal',
+      'unsigned' => TRUE,
+    ),
+    'language' => array(
+      'type' => 'varchar',
+      'not null' => TRUE,
+      'length' => '32',
+      'default' => '',
+    ),
+    'delta' => array(
+      'type' => 'int',
+      'not null' => TRUE,
+      'size' => 'normal',
+      'unsigned' => TRUE,
+    ),
+    'field_reference_3_target_id' => array(
+      'type' => 'int',
+      'not null' => TRUE,
+      'size' => 'normal',
+      'unsigned' => TRUE,
+    ),
+  ),
+  'primary key' => array(
+    'entity_type',
+    'entity_id',
+    'revision_id',
+    'deleted',
+    'delta',
+    'language',
+  ),
+  'indexes' => array(
+    'entity_type' => array(
+      'entity_type',
+    ),
+    'bundle' => array(
+      'bundle',
+    ),
+    'deleted' => array(
+      'deleted',
+    ),
+    'entity_id' => array(
+      'entity_id',
+    ),
+    'revision_id' => array(
+      'revision_id',
+    ),
+    'language' => array(
+      'language',
+    ),
+    'field_reference_3_target_id' => array(
+      'field_reference_3_target_id',
+    ),
+  ),
+  'mysql_character_set' => 'utf8',
+));
+
 $connection->schema()->createTable('file_managed', array(
   'fields' => array(
     'fid' => array(
diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php
index 9f6178e665..b5e1fcad11 100644
--- a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php
+++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php
@@ -72,8 +72,8 @@ protected function getEntityCounts() {
       'contact_form' => 3,
       'contact_message' => 0,
       'editor' => 2,
-      'field_config' => 67,
-      'field_storage_config' => 50,
+      'field_config' => 69,
+      'field_storage_config' => 51,
       'file' => 3,
       'filter_format' => 7,
       'image_style' => 6,
