Just updated a Drupal 8.7.3 to 8.7.4 with simple_sitemap enabled.

This exception is raised when editing a node :

TypeError: Argument 1 passed to Drupal\simple_sitemap\EntityHelper::getEntityInstanceBundleName() must implement interface Drupal\Core\Entity\EntityInterface, null given, called in /app/web/modules/contrib/simple_sitemap/src/Simplesitemap.php on line 727 in Drupal\simple_sitemap\EntityHelper->getEntityInstanceBundleName() (line 80 of modules/contrib/simple_sitemap/src/EntityHelper.php).
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

matthieuscarset created an issue. See original summary.

matthieuscarset’s picture

Issue summary: View changes
matthieuscarset’s picture

Status: Active » Fixed

Nevermind, false alert. Sorry about that.

It was an issue with the Node (actually deleted).

matthieuscarset’s picture

Status: Fixed » Closed (cannot reproduce)
gbyte’s picture

Priority: Critical » Normal
Status: Closed (cannot reproduce) » Closed (works as designed)

No worries, there is an issue about throwing more sensible exceptions, see #3027987: Throw and Catch exceptions in API.

dhanya_girish’s picture

I am getting the same error while editing a node after Drupal upgrade to 8.7.5 from 8.6.7.

TypeError: Argument 1 passed to Drupal\simple_sitemap\EntityHelper::getEntityInstanceBundleName() must be an instance of Drupal\Core\Entity\Entity, instance of Drupal\node\Entity\Node given, called in docroot/modules/contrib/simple_sitemap/src/Form/FormHelper.php on line 308

mjt772’s picture

My apologies for reopening this issue (I'll create a new one if you want).

I'm also getting this exception when attempting to create a new version of a legal document (entity_legal):

TypeError: Argument 1 passed to Drupal\simple_sitemap\EntityHelper::getEntityInstanceBundleName() must implement interface Drupal\Core\Entity\EntityInterface, null given, called in /docroot/modules/contrib/simple_sitemap/src/Simplesitemap.php on line 727 in Drupal\simple_sitemap\EntityHelper->getEntityInstanceBundleName() (line 81 of /docroot/modules/contrib/simple_sitemap/src/EntityHelper.php)

I don't think this was happening with our old 8.x-2.x version of simple_sitemap; we updated to 8.x-3.3 last week.

mjt772’s picture

Version: 8.x-3.2 » 8.x-3.3
Status: Closed (works as designed) » Active
manuel.adan’s picture

I'm also getting what is described in #7, simple_sitemap version 3.3 and the latest -dev of the entity_legal module.

manuel.adan’s picture

This is a simple workaround, it doesn't actually fix the issue but prevents from the exception working with entity legal revisions.

idimopoulos’s picture

I have had exactly the same issue with entity_legal.
The issue however is generic. The issue derives from the fact that simple_sitemap assumes that an entity object that has an id is also saved in the database. However, there is no restriction in Drupal that an entity cannot have an ID before it is saved.
I am providing a small test and some patch about it. The solution from #10 is correct but I placed the solution a bit earlier in code.

idimopoulos’s picture

Status: Active » Needs review

The last submitted patch, 11: 3066138_test_only.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

gbyte’s picture

Status: Needs review » Active

@idimopoulos, @manuel.adan, @mjt772
The issue you describe has nothing to do with op's issue. I have created a new issue here: https://www.drupal.org/project/simple_sitemap/issues/3079897

  • gbyte.co committed 268ec89 on 8.x-3.x
    Revert "Issue #3066138 by idimopoulos, manuel.adan, gbyte.co, mjt772:...
gbyte’s picture

Don't mind the above commit, now ya'll got credited twice, sorry for that. :P

gbyte’s picture

Status: Active » Closed (cannot reproduce)

Regarding op's issue, there is no method that requires Drupal\Core\Entity\Entity object as its parameter. They all require \Drupal\Core\Entity\EntityInterface which is also the interface for \Drupal\Core\Entity\EntityBase. So please provide a way to reproduce this issue; until then I am going to close it as non-reproducible.

johnpicozzi’s picture

I was getting the error here, however the patch here https://www.drupal.org/project/simple_sitemap/issues/3027987#comment-132... resolves the error.

patrick.thurmond@gmail.com’s picture

I'm having this exact same problem when upgrading just Drupal core from 8.6.15 to 8.7.7. But ONLY after upgrading core without any other module changes.

At this initial point of seeing the error, I updated core and ran "drush updb -y". That generates that error when I try to edit a node. I also notice a separate error (this might be two separate issues) where I get "This branch of Entity Browser is not compatible with the version of Media Entity installed" in the command line when running that Drush command.