AcroMedia/commerce-demo

Database errors related to doctrine/annotations and demo template

Opened this issue · 8 comments

I'm installing the demo package into a shared hosting env (siteground) running under PHP7.1 (actually 7.1.21). Install appears to run clean (Compose install, database load, etc.) however browsing to site generates a 'database error come back later' message.

Attempt to follow debug path but Drush CR fails
Error: Uncaught TypeError: Return value of Doctrine\Common\Annotations\AnnotationRegistry::reset() must be an instance of Doctrine\Common\Annotations\void, none returned in /home/<user_id>/public_html/comm/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php:55

I've found I can use Drush to switch default theme to Bartik then Uli to connect access system as admin where I can clear cache, etc.

I can also view content using bartik, so that all looks good, however re-enabling the demo theme gives the database error and log report:

  | Twig_Error_Loader: Template "/web/themes/custom/commerce_2_demo/templates/pages/includes/site_header.html.twig" is not defined in "themes/custom/commerce_2_demo/templates/pages/page--front.html.twig" at line 13. in Twig_Loader_Chain->getCacheKey() (line 129 of /home/paudax02/public_html/comm/vendor/twig/twig/lib/Twig/Loader/Chain.php).

I get the feeling this problem relates to incompatiabilities between PHP7.1. 21 and doctrine/annotations 1.6 but install seems to run clean. Any thoughts? Exactly what versions are you using?

Hi drupauler,

I think you're right about this first error being a php issue. Our demo is currently running on PHP 7.1.20 (cli) and locally I'm running PHP 7.2.2 (cli) so it seems like your version should be fine. Possibly your server config files for your site are set to use PHP 7.0? If that's the case, it might look like you're using PHP 7.1 if you checked it via php --version, but the site config might have that overridden. You could confirm the PHP version being used in the Drupal UI status report page.

If that's not it, I googled that error and some people are reporting that they've fixed it by updating to PHP 7.2. If that's the case, checking the global version of the system would be differ of the globally set PHP 7.1? If that's something you can do, that might be worth a try. I'm not sure what the root cause is though.

You could also try running composer update to get any old dependencies, but since you already did a composer install I don't think this would help. It would be worth a shot though just in case.

The Twig Error Loader issue has also come up a few times before in previous issues. I think the fix for that is just to flush the caches. If I'm not mistaken, you may have provided that answer as a solution previously.

Thanks Mike. Ive been working with the hostingco to try and confirm we're running 7.2 across the board. meanwhile I;ve installed locally under Acquia DevDeskTop and that is limited to 7.1 So definitely looks like a PHP inconsistency in my hosting setup.

Ok. If you find a solution please let me know. It would be good to have a record of it in case it comes up again.

Hi Paul!

It's interesting to me to read your backstory because I think a lot of the struggles you're working through are probably more common than you think. To be honest, I'm more comfortable now on the server side of things then I was a year ago, but troubleshooting server issues are never something I look forward to, and there's always more to learn. I'm lucky that we have some people in-house here that really know that side of things well and so I've been able to learn a bit from them while banging my head against the wall at the same time. Haha.

Lately, at Acro, we've been increasingly adopting Lando for local development. It allows you to spin up a self-contained local development environment where each instance contains everything the project needs. You basically just specify what version of php you want and any other services you need, then when you initialize the project it builds the environment right on the spot. It's pretty wild. What's nice about it is that if you can configure Lando to be the same specs as the server the site will end up on, so theoretically you shouldn't run into any issues once the site files are moved up to the server. It might not be worth your time to learn it, but if you're interested in learning more about Lando, one of our senior devs put a blog together getting commerce running with Lando: https://blog.acromedia.com/installing-drupal-commerce-using-lando

Anywho, I'm glad to hear that you're persevering and that you like the things that we're building! The building is the fun part! 😄

One last thing. If you have trouble getting Drush or Drupal Console running globally, you can always require it with composer instead and then access it at the project level. So if you're in your web root folder, instead of just running drush cr (or whatever), you can then do ../vendor/drush/drush/drush cr because drush gets included there.

As per the comment at:
https://www.drupal.org/forum/support/installing-drupal/2017-10-15/composer-install-d840-failed#comment-12433177

add

"config": {
    "platform": {
        "php": "7.0"
    }
}

I had to increase it to 7.0.8 and there may be a bin-dir setting in there already in which case add the platform to it with a comma:

    "config": {
      "bin-dir": "bin",
      "platform": {
        "php": "7.0.8"
      }
    },

Hello, before reporting this error, first install the database between different servers but the error continues so. I GIVE UP. please help.

Error
Análisis estático:

Se encontraron 411 errores durante el análisis.

Caracter inesperado. (near "" at position 12)
Caracter inesperado. (near "" at position 13)
Caracter inesperado. (near "" at position 14)
Caracter inesperado. (near "" at position 15)
Caracter inesperado. (near "" at position 16)
Caracter inesperado. (near "" at position 17)
Caracter inesperado. (near "" at position 18)
Caracter inesperado. (near "" at position 19)
Caracter inesperado. (near "" at position 20)
Caracter inesperado. (near "" at position 21)
Caracter inesperado. (near "" at position 22)
Caracter inesperado. (near "" at position 23)
Caracter inesperado. (near "" at position 24)
Caracter inesperado. (near "" at position 25)
Caracter inesperado. (near "" at position 26)
Caracter inesperado. (near "" at position 27)
Caracter inesperado. (near "" at position 28)
Caracter inesperado. (near "" at position 29)
Caracter inesperado. (near "" at position 30)
Caracter inesperado. (near "" at position 31)
Caracter inesperado. (near "" at position 32)
Caracter inesperado. (near "" at position 33)
Caracter inesperado. (near "" at position 34)
Caracter inesperado. (near "" at position 35)
Caracter inesperado. (near "" at position 504)
Caracter inesperado. (near "" at position 505)
Caracter inesperado. (near "" at position 506)
Caracter inesperado. (near "" at position 507)
Caracter inesperado. (near "" at position 508)
Caracter inesperado. (near "" at position 509)
Caracter inesperado. (near "" at position 510)
Caracter inesperado. (near "" at position 511)
Tipo de declaración desconocida. (near "database" at position 0)
consulta SQL:

database.sql000664 001750 001750 00257102670 13407266524 015014 0ustar00mhubbardmhubbard000000 000000 -- MySQL dump 10.15 Distrib 10.0.36-MariaDB, for debian-linux-gnu (x86_64) -- -- Host: localhost Database: drupalcommerce_demo -- ------------------------------------------------------ -- Server version 10.0.36-MariaDB-0ubuntu0.16.04.1 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */

Hi @kprichoso,

That error doesn't give me enough information to be able to know why you're getting it. You could try:

  • If you haven't done so already, make sure you look at the README.md for instructions for getting this demo going.
  • Reimporting the provided database. Maybe your initial imports have failed?
  • Run mysqlcheck -r [database name] to check and repair the database. Maybe a table has been corrupted?

Other than, I would need more information to be able to suggest anything different.