The "node" entity cannot have a URI as it does not have an ID in Drupal\Core\Entity\EntityBase->toUrl() (line 161 of core/lib/Drupal/Core/Entity/EntityBase.php).

Created on 17 July 2024, 5 months ago

Problem/Motivation

I get this error in the mercury editor edit page:
Drupal\Core\Entity\EntityMalformedException: The "node" entity cannot have a URI as it does not have an ID in Drupal\Core\Entity\EntityBase->toUrl() (line 161 of core/lib/Drupal/Core/Entity/EntityBase.php).

Mercury editor uses a iframe and i this there is the problem with hreflang.

In hreflang_page_attachments is not check if the varialbe $entity has values.

πŸ› Bug report
Status

Active

Version

1.14

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain Carlitus

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @Carlitus
  • Merge request !4Checked if the entity has id β†’ (Closed) created by paucala
  • Pipeline finished with Success
    5 months ago
    Total: 152s
    #226789
  • πŸ‡ͺπŸ‡ΈSpain Carlitus

    Something strange has happened. I created the MR but when I clicked on the link after the push I had no access. I passed it to my partner paucala and he was able to access it.

  • Status changed to Needs review 3 months ago
  • πŸ‡ΊπŸ‡ΈUnited States mfb San Francisco

    This is a bit strange, as this code is more-or-less taken from core Content Translation module. So, you'd think you would also see this error when Content Translation is in use.

    However, I can look into trying to reproduce this...

  • πŸ‡ΊπŸ‡ΈUnited States mfb San Francisco

    I looked into this issue, and found that the code in Content Translation module would trigger the same exception. And so, apparently, Mercury Editor decided to simply disable the hook_page_attachments() implementation for Content Translation module, rather than properly fixing the issue. Therefore, you won't have any hreflang tags provided by Content Translation module if you enable Mercury Editor. So, that seems like bugs that need to be fixed in both Content Translation module and Mercury Editor.

    In any case, we can resolve the issue in Hreflang module, at least...

    • mfb β†’ committed 89e79c67 on 8.x-1.x
      Issue #3462086 by carlitus, mfb: The "node" entity cannot have a URI as...
  • πŸ‡ΊπŸ‡ΈUnited States mfb San Francisco
  • πŸ‡ΊπŸ‡ΈUnited States mfb San Francisco

    Actually, looks like Mercury Editor re-implemented the Content Translation page attachments, so you do get hreflang links after all. So, just bug in core Content Translation module I guess.

Production build 0.71.5 2024