SQL Query Exception when installing new license

Created on 22 March 2023, about 2 years ago
Updated 27 March 2023, about 2 years ago

Problem/Motivation

When I try to create a new license on a clean install on Drupal 9.5.5, the process generates an exception.

URL of the form for creating the new license:

https://xxx.xxx/web/admin/commerce/licenses/add/role

Error message:

Drupal\Core\Entity\Query\QueryException: 'license_type' not found in Drupal\Core\Entity\Query\Sql\Tables->ensureEntityTable() (line 369 of /var/www/html/com4/web/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php).
🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇺🇸United States bogdog400

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

Comments & Activities

  • Issue created by @bogdog400
  • 🇺🇸United States bogdog400

    This persists after installing the new dev version.

    When I tried to follow the instructions here:

    https://www.drupal.org/node/2039687

    I had these errors:

    * There is no way to follow on step (4) because there's only one option at admin/commerce/config/licenses which is to edit the list of License Types. I can add fields to the one type ("Role") but that's about it.

    * Trying to add a license varation with this URL admin/commerce/licenses/add/role generates this SQL problem:

    Drupal\Core\Entity\Query\QueryException: 'license_type' not found in Drupal\Core\Entity\Query\Sql\Tables->ensureEntityTable() (line 369 of /var/www/html/com3/web/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php).
    
    

    Thanks for all of your attention.

  • 🇮🇱Israel jsacksick

    Just tried now, fetched the latest dev version, and installed it... No error for me...

  • 🇺🇸United States bogdog400

    Sigh.

    I just built a new version with two commands:

    composer create-project drupal/recommended-project XXX
    composer require 'drupal/commerce_license:2.x-dev@dev'

    Same bug. It can't find license_type.

    Do you want me to check whether certain tables are in the database?

  • Assigned to TomTech
  • 🇺🇸United States TomTech

    @bogdog400, I'm presuming you also had to modify the composer.json between those two commands to change minimum stability...then needed to enable the license module after.

    If that is all you have done, though, then, yes, behavior is undefined at that point.

    Please review the read me for the configuration that needs to occur.

    This is occurring because no product variation types have been created with the Provides a license trait, so the entity reference validation is failing...this also causes a bunch of other stuff on the form to not behave for the same reason. (Product Variation entity reference search fails, license period plugin change fails, etc...)

    I'll see about adding a sanity check on the add license form, but you can't add a license without creating a license product variation to reference.

    • TomTech authored 6c2b2b2b on 8.x-2.x
      Issue #3349657 by bogdog400, jsacksick, TomTech: SQL Query Exception...
  • 🇺🇸United States TomTech

    This is addressed in latest dev.

    Also, @bogdog400, the documentation you referenced is for 7.x.

    Currently, only documentation for 8.x/9.x/10.x is the readme.

  • Status changed to Fixed about 2 years ago
  • 🇺🇸United States bogdog400

    Yes, I did switch the stability in composer.json to dev to get it to install.

    I'll look at the README in the git repo and the new dev version to see if that works.

    Thanks for all of your help and attention.

  • 🇺🇸United States bogdog400

    I was able to build a new version from scratch with Drupal 10 and the dev version of commerce_license. Then I followed the instructions on the git repo README successfully to create a product.

    Thanks for all of your attention and help.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024