diff --git a/core/modules/hal/src/LinkManager/RelationLinkManager.php b/core/modules/hal/src/LinkManager/RelationLinkManager.php
index dc6486f..b3a37da 100644
--- a/core/modules/hal/src/LinkManager/RelationLinkManager.php
+++ b/core/modules/hal/src/LinkManager/RelationLinkManager.php
@@ -128,7 +128,7 @@ protected function writeCache($context = []) {
           foreach ($this->entityManager->getFieldDefinitions($entity_type->id(), $bundle) as $field_definition) {
             $relation_uri = $this->getRelationUri($entity_type->id(), $bundle, $field_definition->getName(), $context);
             $data[$relation_uri] = [
-              'entity_type' => $entity_type,
+              'entity_type' => $entity_type->id(),
               'bundle' => $bundle,
               'field_name' => $field_definition->getName(),
             ];
diff --git a/core/modules/hal/tests/src/Kernel/HalLinkManagerTest.php b/core/modules/hal/tests/src/Kernel/HalLinkManagerTest.php
index b675059..e1adba2 100644
--- a/core/modules/hal/tests/src/Kernel/HalLinkManagerTest.php
+++ b/core/modules/hal/tests/src/Kernel/HalLinkManagerTest.php
@@ -3,7 +3,10 @@
 namespace Drupal\Tests\hal\Kernel;
 
 use Drupal\Core\Url;
+use Drupal\field\Entity\FieldConfig;
+use Drupal\field\Entity\FieldStorageConfig;
 use Drupal\KernelTests\KernelTestBase;
+use Drupal\node\Entity\NodeType;
 
 /**
  * @coversDefaultClass \Drupal\hal\LinkManager\LinkManager
@@ -14,13 +17,30 @@ class HalLinkManagerTest extends KernelTestBase {
   /**
    * {@inheritdoc}
    */
-  public static $modules = ['hal', 'hal_test', 'serialization', 'system'];
+  public static $modules = [ 'hal', 'hal_test', 'serialization', 'system', 'node', 'user', 'field'];
 
   /**
    * {@inheritdoc}
    */
   protected function setUp() {
     parent::setUp();
+
+    $this->installEntitySchema('node');
+
+    NodeType::create([
+      'type' => 'page',
+    ])->save();
+    FieldStorageConfig::create([
+      'entity_type' => 'node',
+      'type' => 'entity_reference',
+      'field_name' => 'field_ref',
+    ])->save();
+    FieldConfig::create([
+      'entity_type' => 'node',
+      'bundle' => 'page',
+      'field_name' => 'field_ref',
+    ])->save();
+
     \Drupal::service('router.builder')->rebuild();
   }
 
@@ -59,6 +79,22 @@ public function testGetRelationUri() {
   }
 
   /**
+   * @covers ::getRelationInternalIds
+   */
+  public function testGetRelationInternalIds() {
+    /* @var \Drupal\rest\LinkManager\RelationLinkManagerInterface $relation_manager */
+    $relation_manager = \Drupal::service('hal.link_manager.relation');
+    $link = $relation_manager->getRelationUri('node', 'page', 'field_ref');
+    $internal_ids = $relation_manager->getRelationInternalIds($link);
+
+    $this->assertEquals([
+      'entity_type' => 'node',
+      'bundle' => 'page',
+      'field_name' => 'field_ref'
+    ], $internal_ids);
+  }
+
+  /**
    * @covers ::setLinkDomain
    */
   public function testHalLinkManagersSetLinkDomain() {
