Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Receiving errors while applying Simple Website CMS Community template via directus-template-cli #11

Open
Bossieh opened this issue Jan 21, 2025 · 1 comment

Comments

@Bossieh
Copy link

Bossieh commented Jan 21, 2025

I am receiving errors while applying the Simple Website CMS Community template via the directus-template-cli

Version info:
Directus: 11.4.0
Database: MySQL 9.1.0

Errors:

Loading data for 22 collections... done
-- Request failed. Retrying after 1000ms
-- Retrying job (attempt 1)
-- Request failed. Retrying after 2000ms
-- Retrying job (attempt 2)
-- Request failed. Retrying after 4000ms
-- Retrying job (attempt 3)
-- Max retries reached, not retrying further
 ›   Warning: Directus Error: alter table `block_button` add primary key `block_button_pkey`(`id`) - Multiple primary key defined (Status: 500) {"code":"INTERNAL_SERVER_ERROR"}
-- Request failed. Retrying after 1000ms
-- Retrying job (attempt 1)
-- Request failed. Retrying after 2000ms
-- Retrying job (attempt 2)
-- Request failed. Retrying after 4000ms
-- Retrying job (attempt 3)
-- Max retries reached, not retrying further
 ›   Warning: Directus Error: alter table `block_button_group` add primary key `block_button_group_pkey`(`id`) - Multiple primary key defined (Status: 500) {"code":"INTERNAL_SERVER_ERROR"}
-- Request failed. Retrying after 1000ms
-- Retrying job (attempt 1)
-- Request failed. Retrying after 2000ms
-- Retrying job (attempt 2)
-- Request failed. Retrying after 4000ms
-- Retrying job (attempt 3)
-- Max retries reached, not retrying further
 ›   Warning: Directus Error: alter table `block_form` add primary key `block_form_pkey`(`id`) - Multiple primary key defined (Status: 500) {"code":"INTERNAL_SERVER_ERROR"}
-- Request failed. Retrying after 1000ms
-- Retrying job (attempt 1)
-- Request failed. Retrying after 2000ms
-- Retrying job (attempt 2)
-- Request failed. Retrying after 4000ms
-- Retrying job (attempt 3)
-- Max retries reached, not retrying further
 ›   Warning: Directus Error: alter table `block_gallery` add primary key `block_gallery_pkey`(`id`) - Multiple primary key defined (Status: 500) {"code":"INTERNAL_SERVER_ERROR"}
-- Request failed. Retrying after 1000ms
-- Retrying job (attempt 1)
-- Request failed. Retrying after 2000ms
-- Retrying job (attempt 2)
@philipp-winterle
Copy link

philipp-winterle commented Jan 24, 2025

Current Behaviour

The usage of npx directus-template-cli@latest apply results in errors but partially installed collections without finished relations and missing content.

Expected Behaviour

The template is installed and no errors happen during installation

Specifications

  • Directus 11.4
  • MySQL 8.4.4
  • Template: agencyos / simplecms
  • Collation of all tables (also newly added): utf8mb4_0900_ai_ci
  • Connection with admin api key and email/pass

Speculation

Maybe this is related to how the how directus gets the data by api request.

Error Log

[14:39:14] POST /collections 200 47ms
[14:39:14.709] ERROR: Unexpected token '_', "_utf8mb4\'[]\'" is not valid JSON
    err: {
      "type": "SyntaxError",
      "message": "Unexpected token '_', \"_utf8mb4\\'[]\\'\" is not valid JSON",
      "stack":
tcms_nginx         | 192.168.155.1 - - [24/Jan/2025:14:39:14 +0000] "POST /collections HTTP/1.1" 200 554 "-" "node" "-"
          SyntaxError: Unexpected token '_', "_utf8mb4\'[]\'" is not valid JSON
              at JSON.parse (<anonymous>)
              at parseJSON (file:///directus/node_modules/.pnpm/@directus+utils@[email protected][email protected]_/node_modules/@directus/utils/dist/shared/index.js:131:15)
              at castToObject (file:///directus/node_modules/.pnpm/@directus+api@file+api_@[email protected]_@[email protected][email protected][email protected]____rwsrw2ii2kgfeysgzcibtnsnku/node_modules/@directus/api/dist/utils/get-default-value.js:47:20)
              at getDefaultValue (file:///directus/node_modules/.pnpm/@directus+api@file+api_@[email protected]_@[email protected][email protected][email protected]____rwsrw2ii2kgfeysgzcibtnsnku/node_modules/@directus/api/dist/utils/get-default-value.js:21:20)
              at file:///directus/node_modules/.pnpm/@directus+api@file+api_@[email protected]_@[email protected][email protected][email protected]____rwsrw2ii2kgfeysgzcibtnsnku/node_modules/@directus/api/dist/utils/get-schema.js:111:35
              at file:///directus/node_modules/.pnpm/[email protected]/node_modules/lodash-es/mapValues.js:38:34
              at file:///directus/node_modules/.pnpm/[email protected]/node_modules/lodash-es/_createBaseFor.js:17:11
              at baseForOwn (file:///directus/node_modules/.pnpm/[email protected]/node_modules/lodash-es/_baseForOwn.js:13:20)
              at mapValues (file:///directus/node_modules/.pnpm/[email protected]/node_modules/lodash-es/mapValues.js:37:3)
              at getDatabaseSchema (file:///directus/node_modules/.pnpm/@directus+api@file+api_@[email protected]_@[email protected][email protected][email protected]____rwsrw2ii2kgfeysgzcibtnsnku/node_modules/@directus/api/dist/utils/get-schema.js:108:21)
    }
[15:02:46.293] ERROR: alter table `block_gallery` add primary key `block_gallery_pkey`(`id`) - Multiple primary key defined
    err: {
      "type": "Error",
      "message": "alter table `block_gallery` add primary key `block_gallery_pkey`(`id`) - Multiple primary key defined",
      "stack":
          Error: alter table `block_gallery` add primary key `block_gallery_pkey`(`id`) - Multiple primary key defined
              at Packet.asError (/directus/node_modules/.pnpm/[email protected]/node_modules/mysql2/lib/packets/packet.js:740:17)
              at Query.execute (/directus/node_modules/.pnpm/[email protected]/node_modules/mysql2/lib/commands/command.js:29:26)
              at Connection.handlePacket (/directus/node_modules/.pnpm/[email protected]/node_modules/mysql2/lib/base/connection.js:475:34)
              at PacketParser.onPacket (/directus/node_modules/.pnpm/[email protected]/node_modules/mysql2/lib/base/connection.js:93:12)
              at PacketParser.executeStart (/directus/node_modules/.pnpm/[email protected]/node_modules/mysql2/lib/packet_parser.js:75:16)
              at Socket.<anonymous> (/directus/node_modules/.pnpm/[email protected]/node_modules/mysql2/lib/base/connection.js:100:25)
              at Socket.emit (node:events:524:28)
              at addChunk (node:internal/streams/readable:561:12)
              at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
              at Readable.push (node:internal/streams/readable:392:5)
      "code": "ER_MULTIPLE_PRI_KEY",
      "errno": 1068,
      "sqlState": "42000",
      "sqlMessage": "Multiple primary key defined",
      "sql": "alter table `block_gallery` add primary key `block_gallery_pkey`(`id`)",
      "extensions": {
        "stack":
            Error: alter table `block_gallery` add primary key `block_gallery_pkey`(`id`) - Multiple primary key defined
                at Packet.asError (/directus/node_modules/.pnpm/[email protected]/node_modules/mysql2/lib/packets/packet.js:740:17)
                at Query.execute (/directus/node_modules/.pnpm/[email protected]/node_modules/mysql2/lib/commands/command.js:29:26)
                at Connection.handlePacket (/directus/node_modules/.pnpm/[email protected]/node_modules/mysql2/lib/base/connection.js:475:34)
                at PacketParser.onPacket (/directus/node_modules/.pnpm/[email protected]/node_modules/mysql2/lib/base/connection.js:93:12)
                at PacketParser.executeStart (/directus/node_modules/.pnpm/[email protected]/node_modules/mysql2/lib/packet_parser.js:75:16)
                at Socket.<anonymous> (/directus/node_modules/.pnpm/[email protected]/node_modules/mysql2/lib/base/connection.js:100:25)
                at Socket.emit (node:events:524:28)
                at addChunk (node:internal/streams/readable:561:12)
                at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
                at Readable.push (node:internal/streams/readable:392:5)
      }
    }

Additionally and maybe helpful. The fourth value inserted is the breaking one. '_utf8mb4\\\'{}\\\'' - The fourth column is command_palette_settings in this case. Maybe related

Warning: Directus Error: insert into `directus_settings` (`auth_login_attempts`, `auth_password_policy`, `basemaps`,
 ›   `command_palette_settings`, `custom_aspect_ratios`, `custom_css`, `default_appearance`, `default_language`, `default_theme_dark`,
 ›   `default_theme_light`, `id`, `mapbox_key`, `module_bar`, `project_color`, `project_descriptor`, `project_logo`, `project_name`,
 ›   `project_url`, `public_background`, `public_favicon`, `public_foreground`, `public_note`, `public_registration`,
 ›   `public_registration_email_filter`, `public_registration_role`, `public_registration_verify_email`, `report_bug_url`,
 ›   `report_error_url`, `report_feature_url`, `storage_asset_presets`, `storage_asset_transform`, `storage_default_folder`,
 ›   `theme_dark_overrides`, `theme_light_overrides`) values (25, '/^.{8,}$/', NULL, '_utf8mb4\\\'{}\\\'', NULL,

Other Tests

  • Error does not occur with postgresql db
  • MySQL 5 Other error. Same problem
Error: create table `globals` (`description` text null, `id` char(36) not null, `social_links` json null default ('[]'), `tagline` varchar(255) null, `title` varchar(255) null, `url` varchar(255) null, `favicon` char(36) null, `logo` char(36) null, `openai_api_key` varchar(255) null, `directus_url` varchar(255) null, `logo_dark_mode` char(36) null, `accent_color` varchar(255) null, primary key (`id`)) - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '('[]'), `tagline` varchar(255) null, `title` varchar(255) null, `url` varchar(25' at line 1
              at Packet.asError (/directus/node_modules/.pnpm/[email protected]/node_modules/mysql2/lib/packets/packet.js:740:17)
              at Query.execute (/directus/node_modules/.pnpm/[email protected]/node_modules/mysql2/lib/commands/command.js:29:26)
              at Connection.handlePacket (/directus/node_modules/.pnpm/[email protected]/node_modules/mysql2/lib/base/connection.js:475:34)
              at PacketParser.onPacket (/directus/node_modules/.pnpm/[email protected]/node_modules/mysql2/lib/base/connection.js:93:12)
              at PacketParser.executeStart (/directus/node_modules/.pnpm/[email protected]/node_modules/mysql2/lib/packet_parser.js:75:16)
              at Socket.<anonymous> (/directus/node_modules/.pnpm/[email protected]/node_modules/mysql2/lib/base/connection.js:100:25)
              at Socket.emit (node:events:524:28)
              at addChunk (node:internal/streams/readable:561:12)
              at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
              at Readable.push (node:internal/streams/readable:392:5)
      "code": "ER_PARSE_ERROR",
      "errno": 1064,
      "sqlState": "42000"

Issue with json null default ('[]')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants