UC 8.x-4.0-alpha4
Drupal 8.13

Two instances of "unexpected error" which I think might be related.

1. On saving a content type "Product" whether having created it or editing it, I get the dreaded and ambiguous:

"The website encountered an unexpected error. Please try again later."

Upon saving an original product or saving an edit, the system tries to go to:
hxxp://MYWEBSITE.com/node/24/edit?destination=/admin/content

I think this is correct. This should save and load the content listing page. Instead it generates the error. The content has been saved correctly.

2. A user cannot view their orders. Upon clicking their orders link, the same error is generated. Reloading does nothing. It is simply not viewable by the user.

I am wondering if this #2 is related to #1 above, or if it might be related to the issue for downloadable files which I created at https://www.drupal.org/node/2763807

I am sorry if these are silly issues and frustrate anyone; I am not a coder but fairly sophisticated as far as drupal, but I am stumped.

Comments

shadowmihai created an issue. See original summary.

TR’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: -Ubercart

I haven't seen this happen before. Is it only on products with file downloads, or on every product, or ...? If you could try reproducing this on simplytest.me with a minimal set of modules that would help. There should also be some information in your dblog and your web server error logs.

shadowmihai’s picture

The error only occurs on product files. Other content saves fine and views fine. I did not see anything in my system reports that gave me a clue, but I will look again and provide copies here.

shadowmihai’s picture

Further info:

1. On saving a new product or and edited product, "The website encountered an unexpected error" is returned and the system logs this error:

"Recoverable fatal error: Object of class Drupal\Core\Field\FieldItemList could not be converted to string in Drupal\Core\Database\Statement->execute() (line 59 of /home/gosing/public_html/core/lib/Drupal/Core/Database/Statement.php)."

NOTE that oddly, if I reload the page which displays the error, it reloads to edit screen, with the warning message "The content has either been modified by another user, or you have already submitted modifications. As a result, your changes cannot be saved. "

AND if I make a change at that point, it saves but gives me the same warning. So it seems to be an issue on the creation or the (first in a series of) edits of a product content type only.

2. When a user tries to view his orders, "This website experienced and unexpected error" is generated. The error log displays:

Symfony\Component\Routing\Exception\MissingMandatoryParametersException: Some mandatory parameters are missing ("user") to generate a URL for route "uc_order.user_invoice_print". in Drupal\Core\Routing\UrlGenerator->doGenerate() (line 171 of /home/gosing/public_html/core/lib/Drupal/Core/Routing/UrlGenerator.php).

Symfony is the theme. I also see this "notice":

"Notice: Undefined index: #formatter in uc_product_preprocess_field() (line 49 of /home/gosing/public_html/modules/ubercart/uc_product/uc_product.module)."

Does this help?

shadowmihai’s picture

Status: Postponed (maintainer needs more info) » Active
TR’s picture

The error only occurs on product files. Other content saves fine and views fine.

I meant, does it occur on all products, even products without a file download feature?

Recoverable fatal error: Object of class Drupal\Core\Field\FieldItemList could not be converted to string in Drupal\Core\Database\Statement->execute() (line 59 of /home/gosing/public_html/core/lib/Drupal/Core/Database/Statement.php).

Are you using product kits? That sounds like an issue #2693713: Recoverable fatal error when saving a node used in a product kit we had with product kits which was fixed back in March. You should be using the -dev version of Ubercart to avoid problems that have already been fixed.

2. When a user tries to view his orders, "This website experienced and unexpected error" is generated. The error log displays:

Symfony\Component\Routing\Exception\MissingMandatoryParametersException: Some mandatory parameters are missing ("user") to generate a URL for route "uc_order.user_invoice_print". in Drupal\Core\Routing\UrlGenerator->doGenerate() (line 171 of /home/gosing/public_html/core/lib/Drupal/Core/Routing/UrlGenerator.php).

That was fixed by commit 5f4f1178 back in April. Use the -dev version of Ubercart to keep up with the latest fixes and improvements during the alpha development.

Notice: Undefined index: #formatter in uc_product_preprocess_field() (line 49 of /home/gosing/public_html/modules/ubercart/uc_product/uc_product.module).

That appears to be the same as issue #2752131: Compatibility with custom fields (Display Suite) - minor fix. Are you also using Display Suite?

I strongly suggest you upgrade to the latest -dev release before going further.

shadowmihai’s picture

Yes, I had DS installed, but it was not being used so I uninstalled; updated to latest Ubercart dev version. Unexpected errors fixed. Thanks!

shadowmihai’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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