APIM version 4.5.0 introduced Shared Policy Groups. The default data added to the database by the InitializeSharedPolicyGroupUpgrader includes Unicode emojis in the name and description fields, which potentially cause issues when using a JDBC repository.
As no default charset or collation is specified in the Gravitee JDBC docs for MySQL, we configured our database with default charset utf8 and collation utf8_general_ci. APIM version 4.5.0 now fails to start when the upgrader attempts to insert these Unicode values into the table. I have worked around this by manually changing the charset and collation to utf8mb4 and utf8mb4_unicode_ci on the name and description columns in both the sharedpolicygroups and sharedpolicygrouphistories tables, and also the payload column in the events and events_latest tables.
I'm sure this could be resolved by the relevant Liquibase changeset setting the correct charset/collation on the columns, but the presence of Unicode characters in the default values seems completely unnecessary and could probably just be removed.
To Reproduce
Steps to reproduce the behaviour:
Upgrade from a pre-v4.5.0 version of APIM to v4.5.0 of APIM with a MySQL database with default charset and collation utf8 and utf8_general_ci (I suspect other DB providers would be affected)
Expected behaviour
APIM applies all changes and starts successfully.
Current behaviour
APIM fails to apply the InitializeSharedPolicyGroupUpgrader with the following error:
org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException; SQL state [HY000]; error code [1366]; Incorrect string value: '\xF0\x9F\xA4\x96 A...' for column 'name' at row 1
Describe the bug
APIM version 4.5.0 introduced Shared Policy Groups. The default data added to the database by the
InitializeSharedPolicyGroupUpgrader
includes Unicode emojis in the name and description fields, which potentially cause issues when using a JDBC repository.As no default charset or collation is specified in the Gravitee JDBC docs for MySQL, we configured our database with default charset
utf8
and collationutf8_general_ci
. APIM version 4.5.0 now fails to start when the upgrader attempts to insert these Unicode values into the table. I have worked around this by manually changing the charset and collation toutf8mb4
andutf8mb4_unicode_ci
on the name and description columns in both thesharedpolicygroups
andsharedpolicygrouphistories
tables, and also the payload column in theevents
andevents_latest
tables.I'm sure this could be resolved by the relevant Liquibase changeset setting the correct charset/collation on the columns, but the presence of Unicode characters in the default values seems completely unnecessary and could probably just be removed.
To Reproduce
Steps to reproduce the behaviour:
utf8
andutf8_general_ci
(I suspect other DB providers would be affected)Expected behaviour
APIM applies all changes and starts successfully.
Current behaviour
APIM fails to apply the
InitializeSharedPolicyGroupUpgrader
with the following error:Environment
What is the impacted version? 4.5.0