fikaproductions / fika-gatsby-source-cockpit

This is a Gatsby version 2.\*.\* source plugin that feeds the GraphQL tree with Cockpit Headless CMS collections and singletons data. Actually, it supports querying raw texts (and any trivial field types), Markdown, images, galleries, assets, sets, repeaters, layout(-grid)s (currently only without nested images/assets), objects, linked collections and internationalization.
GNU General Public License v3.0
23 stars 22 forks source link

error Plugin @fika/gatsby-source-cockpit returned an error #30

Closed Hypothesis-github closed 5 years ago

Hypothesis-github commented 5 years ago

I have 2 types of error first is generated with

baseUrl:: "http://domain.com/cockpit",

and is

 error Plugin @fika/gatsby-source-cockpit returned an error

  Error: Token config parameter is invalid

  - CockpitService.js:45 CockpitService.validateToken
    [gatsby-cockpit]/[@fika]/gatsby-source-cockpit/src/CockpitService.js:45:13

second one I change the URL and I add a / at the end

baseUrl:: "http://domain.com/cockpit/",

and it turns into

error Plugin @fika/gatsby-source-cockpit returned an error

  TypeError: names.filter is not a function

  - CockpitService.js:91 CockpitService.getCollections
    [gatsby-cockpit]/[@fika]/gatsby-source-cockpit/src/CockpitService.js:91:10

please guide me.

WhippetsAintDogs commented 5 years ago

Hi @Hypothesis-github!

The baseUrl you should set in your plugin configuration is: http://hfp.co.ir/cockpit, with no / at the end. Did you tried that ? If so, what was the output ?

If it tells you that error: Error: Token config parameter is invalid, it's because you have not properly set your Master API Key in the token configuration parameter. The Master API Key can be generated and found in Cockpit under the Settings > API Access page. :)

DigitalGoldfish commented 5 years ago

TypeError: names.filter is not a function

We should add a check if names is an array and not empty here and either ignore it (no collections might happen once we support singletons) or throw a more appropriate error if we can detect that there is no Cockpit Instance available at that URL..