Strapi V4 slugify plugin not seeing the created models

I just started playing around with strapi using it for my next project with nextjs and i got stuck a little bit on the slug part.

I have installed the slugify plugin in the strapi admin panel, restarted the server and in the roles(permissions) section i enabled it for both authenticated and public roles.After this i created a collection type name Blog. I added some fields to it title, content, cover, slug(short text).

After this i created some blog posts and listed them out on the page. The problem began when i tried to access the blog post using the slug:

``${process.env.NEXT_PUBLIC_STRAPI_URL}/slugify/slugs/blog/${slug}?populate=*,

The url is ok as the slug part is populated and is the value that i have given the slug field when created the blog post. The error that i get is the following:

blog model name not found, all models must be defined in the settings and are case sensitive.

The problem is that the slugify plugin is trying to match the model name to the existing ones and its not finding it so throws this error.

I started to dig a little bit deeper and began to console log in the slugify plugin inside strapi node_module:

module.exports = ({ strapi }) => ({
    async findSlug(ctx) {
        const { models } = getPluginService(strapi, 'settingsService').get();
        const { modelName, slug } = ctx.request.params;
        const { auth } = ctx.state;

        console.log(getPluginService(strapi, 'settingsService').get());

        isValidFindSlugParams({
            modelName,
            slug,
            models,
        });

As you can see it should container a models param aswell that should contain all the current models created in strapi. However the model paramateres comes back as an empty object, its like the plugin does not see the created collections.

The collections were created after the instalation of the slugify plugin.

I am developing on localhost using sqlite with strapi v4.

Any ideas why is this happening? Anyone else encountered this error?

Thanks, Trix

1 Like

Man this forum isn’t helpfull at all.
Really hard to get started using strapi if you dont get any help if you get stuck.

1 Like