Skip to content

Unable to function with gridsome-source-graphql as a source #2

@ghost

Description

When I try to use the gridsome-source-graphql source, the recommender plugin cannot find the specified option.typeName

The error message I receive is:

Gridsome v0.7.20

Initializing plugins...
gridsome-plugin-recommender: options.typeName 'craft' cannot be found - make sure the collection exists

I am using CraftCMS as a GraphQL data source. When I try to switch to the source-filesystem such as your example, then it does work, so I believe it's related to the async nature of retrieving the graphql data source and it not being loaded while the recommender loads in.

Here is an excerpt from my gridsome.config.js file which does not work.

  plugins: [
    {
      use: '@gridsome/source-graphql',
      options: {
        url: process.env.CRAFT_API_URL,
        fieldName: 'craft',
        typeName: 'craft',
        headers: {
          Authorization: `Bearer ${process.env.CRAFT_API_TOKEN}`,
        }
      }
    },
    {
      use: "gridsome-plugin-recommender",
      options: {
        enabled: true,
        typeName: 'craft',
        field: 'mainContent',
        relatedFieldName: 'related',
        minScore: 0.01,
        maxScore: 1,
        minRelations:3,
        maxRelations: 10,
        fillWithRandom:false,
        debug: false
      }
    },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions