strapi-community / strapi-plugin-slugify

A plugin for Strapi Headless CMS that provides the ability to auto slugify a field for any content type.

Home Page:https://market.strapi.io/plugins/strapi-plugin-slugify

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sqlite Error, Unique constraint failed slug

janfess opened this issue · comments

Hi,

Node 16.20
Strapi 4.12.5
better-sqlite3 8.5.0
strapipluginslugify 2.3.4

I am having an issue with the slug generation. When sending a request for creating a new event for an authenticated user, on the backend I am getting an sqlite error but the event gets created and slug generated in strapi. I've also tried different event-names but still getting this error.

{
  "data": {
    "name": "Tech Conference 2023",
    "performers": "Keynote Speaker: John Doe",
    "venue": "City Convention Center",
    "address": "456 Tech Street, Techville",
    "date": "2023-09-10",
    "time": "09:00 - 17:00",
    "description": "Join us at Tech Conference 2023, where industry experts and thought leaders will share insights on the latest trends in technology. The conference will cover topics such as AI, cybersecurity, blockchain, and more. Don't miss this opportunity to connect with fellow tech enthusiasts and gain valuable knowledge to drive innovation in your projects."
  }
}

[2023-08-25 11:14:39.528] error: insert into events (address, created_at, date, description, name, performers, published_at, slug, time, updated_at, venue) values ('456 Tech Street, Techville', '2023-08-25 11:14:39.522', '2023-09-10 00:00:00.000', 'Join us at Tech Conference 2023, where industry experts and thought leaders will share insights on the latest trends in technology. The conference will cover topics such as AI, cybersecurity, blockchain, and more. Don''t miss this opportunity to connect with fellow tech enthusiasts and gain valuable knowledge to drive innovation in your projects.', 'Tech Conference 2023', 'Keynote Speaker: John Doe', '2023-08-25 11:14:39.495', 'tech-conference-2023', '09:00 - 17:00', '2023-08-25 11:14:39.522', 'City Convention Center') returning id - UNIQUE constraint failed: events.slug

Can you post the content type schema of this content type? I will see if I can reproduce this.

Can you post the content type schema of this content type? I will see if I can reproduce this.

  "kind": "collectionType",
  "collectionName": "events",
  "info": {
    "singularName": "event",
    "pluralName": "events",
    "displayName": "Events"
  },
  "options": {
    "draftAndPublish": true
  },
  "pluginOptions": {},
  "attributes": {
    "name": {
      "type": "string"
    },
    "slug": {
      "type": "uid",
      "targetField": "name"
    },
    "venue": {
      "type": "string"
    },
    "address": {
      "type": "string"
    },
    "date": {
      "type": "datetime"
    },
    "time": {
      "type": "string"
    },
    "performers": {
      "type": "string"
    },
    "description": {
      "type": "richtext"
    },
    "image": {
      "allowedTypes": [
        "images",
        "files",
        "videos",
        "audios"
      ],
      "type": "media",
      "multiple": false
    },
    "user": {
      "type": "relation",
      "relation": "manyToOne",
      "target": "plugin::users-permissions.user",
      "inversedBy": "events"
    }
  }
}

I cannot reproduce this issue when using different name values. When I use the same value twice for name without counter then it does give me this error (as expected) but does not create the entry (as expected).

What settings do you have enabled for this plugin?

Closing due to inactivity, if issue persists with a reproducible example we can revisit.