Page 1 of 1

ERROR during upgrade from v3.0.3.8 to v3.0.3.9 => SyntaxError: Unexpected token '<', "Warning"... is not valid JSON pa

Posted: Sat Jun 15, 2024 6:04 am
by skidrow
using:
  • Ubuntu 22.04.03/LTS
  • Apache 2.4.52/FPM
  • PHP 7.4.33
  • MySQL v8.0.37
  • Opencart v3.0.3.8
  • default theme
During upgrade from v3.0.3.8 to v3.0.3.9 I am getting error:

Code: Select all

SyntaxError: Unexpected token '<', "Warning"... is not valid JSON parsererror Warning: mysqli::query(): (23000/1062): Duplicate entry '28-3-1' for key 'oc_product_attribute.PRIMARY' in /var/www/html/opencart3038/public_html/system/library/db/mysqli.php on line 25{"error":"Error Code(0): Error: Duplicate entry '28-3-1' for key 'oc_product_attribute.PRIMARY'
Error No: 1062
ALTER TABLE `oc_product_attribute` ADD PRIMARY KEY(`product_id`,`attribute_id`,`language_id`) in \/var\/www\/html\/opencart3038\/public_html\/system\/library\/db\/mysqli.php on line 49"}
See screenshot #1 below.

I followed the steps in the included UPGRADE markdown file.
As the error shown concerns a SYNTAX error, how to proceed now?

PLEASE NOTE:
  • The error mentions a duplicate key.
  • I like to stress that I started out with a correct populated database w.o. errors.
  • So any errors reported must be caused by the upgrade procedure, especially since the error mentions a SYNTAX error.

Re: ERROR during upgrade from v3.0.3.8 to v3.0.3.9 => SyntaxError: Unexpected token '<', "Warning"... is not valid JSO

Posted: Sat Jun 15, 2024 8:16 am
by nonnedelectari
skidrow wrote:
Sat Jun 15, 2024 6:04 am
using:
  • Ubuntu 22.04.03/LTS
  • Apache 2.4.52/FPM
  • PHP 7.4.33
  • MySQL v8.0.37
  • Opencart v3.0.3.8
  • default theme
During upgrade from v3.0.3.8 to v3.0.3.9 I am getting error:

Code: Select all

SyntaxError: Unexpected token '<', "Warning"... is not valid JSON parsererror Warning: mysqli::query(): (23000/1062): Duplicate entry '28-3-1' for key 'oc_product_attribute.PRIMARY' in /var/www/html/opencart3038/public_html/system/library/db/mysqli.php on line 25{"error":"Error Code(0): Error: Duplicate entry '28-3-1' for key 'oc_product_attribute.PRIMARY'
Error No: 1062
ALTER TABLE `oc_product_attribute` ADD PRIMARY KEY(`product_id`,`attribute_id`,`language_id`) in \/var\/www\/html\/opencart3038\/public_html\/system\/library\/db\/mysqli.php on line 49"}
See screenshot #1 below.

I followed the steps in the included UPGRADE markdown file.
As the error shown concerns a SYNTAX error, how to proceed now?

PLEASE NOTE:
  • The error mentions a duplicate key.
  • I like to stress that I started out with a correct populated database w.o. errors.
  • So any errors reported must be caused by the upgrade procedure, especially since the error mentions a SYNTAX error.
Ignore the syntax error, it is just because the JS gets an error page back which is not json encoded, an error message on the error message basically.
The real error is that you attempting to add a primary key to the oc_product_attribute table which already has duplicate entries for that key.

Re: ERROR during upgrade from v3.0.3.8 to v3.0.3.9 => SyntaxError: Unexpected token '<', "Warning"... is not valid JSO

Posted: Thu Jun 20, 2024 5:19 am
by skidrow
Ignoring the JSON part of the error, UPGRADE is reporting a DUPLICATE KEY on an intact and coherent database (see screenshot #4).

This proves that the DUPLICATE KEY error is not caused by an user-generated action and cannot be the cause of the error.

Investigation shows that UPGRADE is failing to ALTER the structure of table:

Code: Select all

oc_product_attribute
This table has a PRIMARY KEY consisting of 4 individual fields (see screenshot #1, #2, #3, and #4).

UPGRADE drops one of the 4 individual fields so that the PRIMARY KEY is now being build from 3 out of the 4 individual fields.
This results in the PRIMARY KEYs no longer being unique what causes the DUPLICATE KEY error (see screenshot #5, #6, and #7).

Please update the UPGRADE procedure of OpenCart v3.0.3.9 to deal with this.

PLEASE NOTE: I uploaded 7 screenshots but only 3 are accepted? This is a technical support forum, isn't?

Re: ERROR during upgrade from v3.0.3.8 to v3.0.3.9 => SyntaxError: Unexpected token '<', "Warning"... is not valid JSO

Posted: Thu Jun 20, 2024 5:40 am
by ADD Creative
There isn't a preset_id in the OpenCart oc_product_attribute table, so that's not something that can be fixed. You could however modify your install/opencart.sql to match the changes made to your database.

Re: ERROR during upgrade from v3.0.3.8 to v3.0.3.9 => SyntaxError: Unexpected token '<', "Warning"... is not valid JSO

Posted: Thu Jun 20, 2024 12:48 pm
by Jaesin
Dont mean to derail this, but I cam here for a similar concern.... in my 3038 to 3039 upgrade...
My error is the following while trying to upgrade....

SyntaxError: Unexpected token '<', "Warning"... is not valid JSON parsererror Warning: mysqli::query(): (HY000/1283): Column 'description' cannot be part of FULLTEXT index in /var/www/vhosts/mydomain.com/httpdocs/system/library/db/mysqli.php on line 25{"error":"Error Code(0): Error: Column 'description' cannot be part of FULLTEXT index
Error No: 1283
ALTER TABLE `oc_product_description` CHANGE `name` `name` VARCHAR(255) NOT NULL AFTER `language_id` in \/var\/www\/vhosts\/mydomain.com\/httpdocs\/system\/library\/db\/mysqli.php on line 49"}


Should I start a different question thread?

Thx

Re: ERROR during upgrade from v3.0.3.8 to v3.0.3.9 => SyntaxError: Unexpected token '<', "Warning"... is not valid JSO

Posted: Thu Jun 20, 2024 4:12 pm
by ADD Creative
Jaesin wrote:
Thu Jun 20, 2024 12:48 pm
Dont mean to derail this, but I cam here for a similar concern.... in my 3038 to 3039 upgrade...
My error is the following while trying to upgrade....

SyntaxError: Unexpected token '<', "Warning"... is not valid JSON parsererror Warning: mysqli::query(): (HY000/1283): Column 'description' cannot be part of FULLTEXT index in /var/www/vhosts/mydomain.com/httpdocs/system/library/db/mysqli.php on line 25{"error":"Error Code(0): Error: Column 'description' cannot be part of FULLTEXT index
Error No: 1283
ALTER TABLE `oc_product_description` CHANGE `name` `name` VARCHAR(255) NOT NULL AFTER `language_id` in \/var\/www\/vhosts\/mydomain.com\/httpdocs\/system\/library\/db\/mysqli.php on line 49"}


Should I start a different question thread?

Thx
It probably better to start you own topic. However, your issue is similar in that something has changed you database tables and added FULLTEXT to the description column of the oc_product_description table. OpenCart does not use FULLTEXT in any tables.

There are no major changes to the database between 3.0.3.8 and 3.0.3.9, so you are probably safe skipping the upgrade script.