After upgrading to 8.7.1 I suddenly encounter the following error while adding media or paragraphs on node creation:

entity cannot have a URI as it does not have an ID.

This takes me to node_tokens() in node.tokens.inc where a URL is created for a (not yet) existing node and breaks creation:

        case 'url':
          $replacements[$original] = $node->toUrl('canonical', $url_options)->toString();
          break;

        case 'edit-url':
          $replacements[$original] = $node->toUrl('edit-form', $url_options)->toString();
          break;

After patching the node_tokens() like so:

        case 'url':
          $replacements[$original] = !$node->isNew() ? $node->toUrl('canonical', $url_options)->toString() : t('not yet available.');
          break;

        case 'edit-url':
          $replacements[$original] = !$node->isNew() ? $node->toUrl('edit-form', $url_options)->toString() : t('not yet available.');
          break;

This works as initially expected.

Does anybody else encounter this issue or is something else going on?

Thanks for feedback.

Comments

smanhoff created an issue. See original summary.

smanhoff’s picture

Title: Node token should check if node is new » Node tokens doesn't check if entity is created and fails when empty.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.9 was released on November 6 and is the final full bugfix release for the Drupal 8.7.x series. Drupal 8.7.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.8.0 on December 4, 2019. (Drupal 8.8.0-beta1 is available for testing.)

Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

darvanen’s picture

Version: 8.9.x-dev » 9.3.x-dev
Status: Active » Postponed (maintainer needs more info)
Issue tags: +Needs steps to reproduce

At face value this looks like a problem with the author's site, needs steps to reproduce on a clean installation of Drupal.

As that is the case and there has been no activity here for 2 years and 4 months, I'm marking this "Postponed (maintainer needs more info)". If we don't receive additional information to help with the issue, it may be closed after three months.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

kristen pol’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)
Issue tags: +Bug Smash Initiative

Thanks for reporting this issue. We rely on issue reports like this one to resolve bugs and improve Drupal core.

As part of the Bug Smash Initiative, we are triaging issues that are marked "Postponed (maintainer needs more info)". This issue was marked "Postponed (maintainer needs more info)" a year ago and there has been no activity here since that time.

It was previously noted that the issue could be closed after 3 months and that was 12 months ago.

Given that and, since we still need more information to move forward with this issue and that information wasn't provided, I'm marking the issue "Closed (cannot reproduce)".

Thanks!