mpartipilo / gatsby-source-cockpit

Gatsby plugin to access remote content from a Cockpit API (http://getcockpit.com/)
MIT License
13 stars 3 forks source link

Plugin gatsby-source-cockpit returned an error #5

Closed renickbuettner closed 5 years ago

renickbuettner commented 5 years ago

I've some trouble setting up the source plugin with gatsby. I get this error:

success open and validate gatsby-config — 0.013 s
success load plugins — 0.369 s
success onPreInit — 0.572 s
success delete html and css files from previous builds — 0.068 s
success initialize cache — 0.045 s
success copy gatsby files — 0.034 s
success onPreBootstrap — 0.006 s
info Cockpit host: ########
info Cockpit access token: ########
info Fetching list of assets
error Plugin gatsby-source-cockpit returned an error

  TypeError: Cannot read property 'length' of undefined

  - gatsby-node.js:38 Object.exports.sourceNodes
    [renickbuettner2]/[gatsby-source-cockpit]/gatsby-node.js:38:65

error Cannot read property 'filter' of undefined

  TypeError: Cannot read property 'filter' of undefined

  - api-runner-node.js:274 Promise.mapSeries.catch.then.results
    [renickbuettner2]/[gatsby]/dist/utils/api-runner-node.js:274:42

  - util.js:16 tryCatcher
    [renickbuettner2]/[bluebird]/js/release/util.js:16:23

  - promise.js:512 Promise._settlePromiseFromHandler
    [renickbuettner2]/[bluebird]/js/release/promise.js:512:31

  - promise.js:569 Promise._settlePromise
    [renickbuettner2]/[bluebird]/js/release/promise.js:569:18

  - promise.js:614 Promise._settlePromise0
    [renickbuettner2]/[bluebird]/js/release/promise.js:614:10

  - promise.js:693 Promise._settlePromises
    [renickbuettner2]/[bluebird]/js/release/promise.js:693:18

  - async.js:133 Async._drainQueue
    [renickbuettner2]/[bluebird]/js/release/async.js:133:16

  - async.js:143 Async._drainQueues
    [renickbuettner2]/[bluebird]/js/release/async.js:143:10

  - async.js:17 Immediate.Async.drainQueues [as _onImmediate]
    [renickbuettner2]/[bluebird]/js/release/async.js:17:14

error UNHANDLED REJECTION

  TypeError: Cannot read property 'filter' of undefined

  - api-runner-node.js:274 Promise.mapSeries.catch.then.results
    [renickbuettner2]/[gatsby]/dist/utils/api-runner-node.js:274:42

  - util.js:16 tryCatcher
    [renickbuettner2]/[bluebird]/js/release/util.js:16:23

  - promise.js:512 Promise._settlePromiseFromHandler
    [renickbuettner2]/[bluebird]/js/release/promise.js:512:31

  - promise.js:569 Promise._settlePromise
    [renickbuettner2]/[bluebird]/js/release/promise.js:569:18

  - promise.js:614 Promise._settlePromise0
    [renickbuettner2]/[bluebird]/js/release/promise.js:614:10

  - promise.js:693 Promise._settlePromises
    [renickbuettner2]/[bluebird]/js/release/promise.js:693:18

  - async.js:133 Async._drainQueue
    [renickbuettner2]/[bluebird]/js/release/async.js:133:16

  - async.js:143 Async._drainQueues
    [renickbuettner2]/[bluebird]/js/release/async.js:143:10

  - async.js:17 Immediate.Async.drainQueues [as _onImmediate]
    [renickbuettner2]/[bluebird]/js/release/async.js:17:14
mpartipilo commented 5 years ago

Hi. I’m afraid my code expects assets to always be present in the Cockpit instance.

This might also happen if the fetch fails.

Add at least one asset to your Cockpit and see if that fixes it.

If not, check your API key, there might be something wrong with the API key you’re using.

On 29 Sep 2018, at 18:53, renickbuettner notifications@github.com wrote:

I've some trouble setting up the source plugin with gatsby. I get this error:

success open and validate gatsby-config — 0.013 s success load plugins — 0.369 s success onPreInit — 0.572 s success delete html and css files from previous builds — 0.068 s success initialize cache — 0.045 s success copy gatsby files — 0.034 s success onPreBootstrap — 0.006 s info Cockpit host: ######## info Cockpit access token: ######## info Fetching list of assets error Plugin gatsby-source-cockpit returned an error

TypeError: Cannot read property 'length' of undefined

  • gatsby-node.js:38 Object.exports.sourceNodes [renickbuettner2]/[gatsby-source-cockpit]/gatsby-node.js:38:65

error Cannot read property 'filter' of undefined

TypeError: Cannot read property 'filter' of undefined

  • api-runner-node.js:274 Promise.mapSeries.catch.then.results [renickbuettner2]/[gatsby]/dist/utils/api-runner-node.js:274:42

  • util.js:16 tryCatcher [renickbuettner2]/[bluebird]/js/release/util.js:16:23

  • promise.js:512 Promise._settlePromiseFromHandler [renickbuettner2]/[bluebird]/js/release/promise.js:512:31

  • promise.js:569 Promise._settlePromise [renickbuettner2]/[bluebird]/js/release/promise.js:569:18

  • promise.js:614 Promise._settlePromise0 [renickbuettner2]/[bluebird]/js/release/promise.js:614:10

  • promise.js:693 Promise._settlePromises [renickbuettner2]/[bluebird]/js/release/promise.js:693:18

  • async.js:133 Async._drainQueue [renickbuettner2]/[bluebird]/js/release/async.js:133:16

  • async.js:143 Async._drainQueues [renickbuettner2]/[bluebird]/js/release/async.js:143:10

  • async.js:17 Immediate.Async.drainQueues [as _onImmediate] [renickbuettner2]/[bluebird]/js/release/async.js:17:14

error UNHANDLED REJECTION

TypeError: Cannot read property 'filter' of undefined

  • api-runner-node.js:274 Promise.mapSeries.catch.then.results [renickbuettner2]/[gatsby]/dist/utils/api-runner-node.js:274:42

  • util.js:16 tryCatcher [renickbuettner2]/[bluebird]/js/release/util.js:16:23

  • promise.js:512 Promise._settlePromiseFromHandler [renickbuettner2]/[bluebird]/js/release/promise.js:512:31

  • promise.js:569 Promise._settlePromise [renickbuettner2]/[bluebird]/js/release/promise.js:569:18

  • promise.js:614 Promise._settlePromise0 [renickbuettner2]/[bluebird]/js/release/promise.js:614:10

  • promise.js:693 Promise._settlePromises [renickbuettner2]/[bluebird]/js/release/promise.js:693:18

  • async.js:133 Async._drainQueue [renickbuettner2]/[bluebird]/js/release/async.js:133:16

  • async.js:143 Async._drainQueues [renickbuettner2]/[bluebird]/js/release/async.js:143:10

  • async.js:17 Immediate.Async.drainQueues [as _onImmediate] [renickbuettner2]/[bluebird]/js/release/async.js:17:14

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mpartipilo/gatsby-source-cockpit/issues/5, or mute the thread https://github.com/notifications/unsubscribe-auth/AAcgae2Qn0PrHAOT94fvLLsLBpY9rFdqks5uf6V2gaJpZM4XAlra.

renickbuettner commented 5 years ago

Hi. Thanks for your fast answer. I've already checked the api key and there are some assets :/

renickbuettner commented 5 years ago

Now I'm using the account key and there's a new error:

info Fetching list of assets
info Assets retrieved: Found 1 assets
info Specified Collections:
error Plugin gatsby-source-cockpit returned an error

  TypeError: items is not iterable

  - console-reporter.js:162 ConsoleReporter.list
    [renickbuettner2]/[yurnalist]/dist/reporters/console/console-reporter.js:162:26

  - gatsby-node.js:41 Object.exports.sourceNodes
    [renickbuettner2]/[gatsby-source-cockpit]/gatsby-node.js:41:12

error Cannot read property 'filter' of undefined

  TypeError: Cannot read property 'filter' of undefined

  - api-runner-node.js:274 Promise.mapSeries.catch.then.results
    [renickbuettner2]/[gatsby]/dist/utils/api-runner-node.js:274:42

  - util.js:16 tryCatcher
    [renickbuettner2]/[bluebird]/js/release/util.js:16:23

  - promise.js:512 Promise._settlePromiseFromHandler
    [renickbuettner2]/[bluebird]/js/release/promise.js:512:31

  - promise.js:569 Promise._settlePromise
    [renickbuettner2]/[bluebird]/js/release/promise.js:569:18

  - promise.js:614 Promise._settlePromise0
    [renickbuettner2]/[bluebird]/js/release/promise.js:614:10

  - promise.js:693 Promise._settlePromises
    [renickbuettner2]/[bluebird]/js/release/promise.js:693:18

  - async.js:133 Async._drainQueue
    [renickbuettner2]/[bluebird]/js/release/async.js:133:16

  - async.js:143 Async._drainQueues
    [renickbuettner2]/[bluebird]/js/release/async.js:143:10

  - async.js:17 Immediate.Async.drainQueues [as _onImmediate]
    [renickbuettner2]/[bluebird]/js/release/async.js:17:14

error UNHANDLED REJECTION

  TypeError: Cannot read property 'filter' of undefined

  - api-runner-node.js:274 Promise.mapSeries.catch.then.results
    [renickbuettner2]/[gatsby]/dist/utils/api-runner-node.js:274:42

  - util.js:16 tryCatcher
    [renickbuettner2]/[bluebird]/js/release/util.js:16:23

  - promise.js:512 Promise._settlePromiseFromHandler
    [renickbuettner2]/[bluebird]/js/release/promise.js:512:31

  - promise.js:569 Promise._settlePromise
    [renickbuettner2]/[bluebird]/js/release/promise.js:569:18

  - promise.js:614 Promise._settlePromise0
    [renickbuettner2]/[bluebird]/js/release/promise.js:614:10

  - promise.js:693 Promise._settlePromises
    [renickbuettner2]/[bluebird]/js/release/promise.js:693:18

  - async.js:133 Async._drainQueue
    [renickbuettner2]/[bluebird]/js/release/async.js:133:16

  - async.js:143 Async._drainQueues
    [renickbuettner2]/[bluebird]/js/release/async.js:143:10

  - async.js:17 Immediate.Async.drainQueues [as _onImmediate]
    [renickbuettner2]/[bluebird]/js/release/async.js:17:14
mpartipilo commented 5 years ago

I just published version 1.0.7, which I use locally to build my only site using cockpit.

It might have a couple bugs fixed, or be totally broken

On 29 Sep 2018, at 19:27, renickbuettner notifications@github.com wrote:

Hi. Thanks for your fast answer. I've already checked the api key and there are some assets :/

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mpartipilo/gatsby-source-cockpit/issues/5#issuecomment-425661811, or mute the thread https://github.com/notifications/unsubscribe-auth/AAcgaS8qNa8i8G8kaRMt_Ak54b9OmscHks5uf61qgaJpZM4XAlra.

mpartipilo commented 5 years ago

Funny, there is no “items” string in the code.

I have not tested this plugin with Gatsby v2 yet. Could that be the problem?

On 29 Sep 2018, at 19:37, renickbuettner notifications@github.com wrote:

Now I'm using the account key and there's a new error:

info Fetching list of assets info Assets retrieved: Found 1 assets info Specified Collections: error Plugin gatsby-source-cockpit returned an error

TypeError: items is not iterable — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mpartipilo/gatsby-source-cockpit/issues/5#issuecomment-425662566, or mute the thread https://github.com/notifications/unsubscribe-auth/AAcgaa7eRmCwGk2v6NqizC4hobDi9flSks5uf6_igaJpZM4XAlra.

renickbuettner commented 5 years ago

Yes maybe, I'm using v2 of Gatsby.

renickbuettner commented 5 years ago

I guess there is something wrong with the cockpit-api-client (a dependency)

renickbuettner commented 5 years ago

Ohh I got it!

info Assets retrieved: Found 1 assets
info Specified Collections:    <----
error Plugin gatsby-source-cockpit returned an error

In the config, I don't wrote down the collections. I thought it would use all.

mpartipilo commented 5 years ago

The other cockpit plugin does. I was planning on implementing that too, but have been too busy to put the time on it.

On 29 Sep 2018, at 19:55, renickbuettner notifications@github.com wrote:

Ohh I got it!

info Assets retrieved: Found 1 assets info Specified Collections: <---- error Plugin gatsby-source-cockpit returned an error In the config, I don't wrote down the collections. I thought it would use all.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mpartipilo/gatsby-source-cockpit/issues/5#issuecomment-425663807, or mute the thread https://github.com/notifications/unsubscribe-auth/AAcgaQUYGNlTaLan7dtvMzUlwCbrSl94ks5uf7QigaJpZM4XAlra.

mpartipilo commented 5 years ago

I'll close this for now keeping in mind to add that feature to fetch all collections.