Skip to content

[BUG] OpenGraph Types #92

Open
Open

Description

@dimitrisganotis

Bug report

Required System information

  • Node.js version: v20.15.1
  • NPM version: v10.9.0
  • Strapi version: v5.3.0
  • Database: MySQL 8
  • Operating system: Ubuntu 22.04
  • Is your project Javascript or Typescript: Typescript
  • SEO Plugin version: v2.0.4

Describe the bug

When I try to generate the types, I get an error.

strapi ts:generate-types

[INFO] [2024-11-14T15:26:40.452Z] (Typegen) Starting the type generation process
[INFO] [2024-11-14T15:26:40.452Z] (Typegen) Generating types for contentTypes
[INFO] [2024-11-14T15:26:40.668Z] (Typegen) Generating types for components
[ERROR] [2024-11-14T15:26:40.713Z] (Typegen) Failed to generate types for components: ';' expected. (1020:23)
1018 | };
1019 | attributes: {

1020 | og:description: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.SetMinMaxLength<{
| ^
1021 | maxLength: 200;
1022 | }>;
1023 | og:image: Schema.Attribute.Media<"images">;. Exiting
[INFO] [2024-11-14T15:26:40.713Z] (Typegen) The task errored with 0 warning(s) and 1 error(s) in 0.261s.
[2024-11-14 16:26:40.713] info: Shutting down Strapi
[2024-11-14 16:26:40.715] info: Strapi has been shut down

It seems that the new open-graph component doesn't have valid attribute names. A solution would be to remove the "og:" from the attributes.

Activity

  1. Bambalazs commented on Dec 4, 2024

    @Bambalazs

    Can confirm, this issue is still blocking Strapi to generate contentTypes.d.ts automatically, therefore any new single or collection types cannot be created. As a temporary solution, I had to rename og property names in OpenGraph component.

    Screenshot 2024-12-04 at 11 28 17
  2. abhex commented on Dec 4, 2024

    @abhex

    `
    [ERROR] [2024-12-04T10:18:08.540Z] (Typegen) Failed to generate types for components: ';' expected. (110:23)
    108 | };
    109 | attributes: {

    110 | og:description: Schema.Attribute.String & Schema.Attribute.Required & Schema.Attribute.SetMinMaxLength<{
    | ^
    111 | maxLength: 200;
    112 | }>;
    113 | og:image: Schema.Attribute.Media<"images">;. Exiting
    [INFO] [2024-12-04T10:18:08.541Z] (Typegen) The task errored with 0 warning(s) and 1 error(s) in 0.418s.
    [2024-12-04 15:18:08.541] info: Shutting down Strapi
    [2024-12-04 15:18:08.544] info: Strapi has been shut down
    `

    Can confirm having the same issue.

  3. KostarSf commented on Dec 21, 2024

    @KostarSf

    same issue.

  4. Muhammad-Sharaf commented on Jan 3, 2025

    @Muhammad-Sharaf

    same issue, had to rename filds in src > components > shared > open-graph.json
    from for example: og:title to og_title

    this got strapi working, but seo analysis for og tags is no more being calculated

  5. Kvintus commented on Jan 4, 2025

    @Kvintus
    Contributor

    @Muhammad-Sharaf @abhex @Bambalazs @KostarSf @dimitrisganotis Hi guys, I fixed the issue both with the graqphl build fail and the previews.

    You can take a look at the PR #97, maybe upvote it so that we can get it merged quickly. Thank You.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions