sviande / gatsby-source-wallabag

Gatsby source wallabag
0 stars 0 forks source link

"gatsby-source-wallabag" threw an error while running the sourceNodes lifecycle #2

Closed BradNut closed 3 years ago

BradNut commented 3 years ago

Using Gatsby V4 packages Source Wallabag Plugin throws an error. Seems that touchNode on V3 onward takes a node instead of a nodeId? https://www.gatsbyjs.com/docs/reference/release-notes/migrating-from-v2-to-v3/#touchnode

Error:

ERROR #11321 PLUGIN

"gatsby-source-wallabag" threw an error while running the sourceNodes lifecycle:

Cannot read properties of undefined (reading 'type')

11 | n => n.internal.owner === gatsby-source-wallabag 12 | )

13 | existingNodes.forEach(n => touchNode({ nodeId: n.id })) | ^ 14 | 15 | 16 | const pluginStatus = store.getState().status.plugins[

File: node_modules/gatsby-source-wallabag/gatsby-node.js:13:30

TypeError: Cannot read properties of undefined (reading 'type')

Dependency versions:

"gatsby": "^4.1.6",
"gatsby-plugin-image": "^2.1.3",
"gatsby-plugin-nprogress": "^4.1.0",
"gatsby-plugin-react-helmet": "^5.1.0",
"gatsby-plugin-remove-trailing-slashes": "^4.1.0",
"gatsby-plugin-sharp": "^4.1.4",
"gatsby-plugin-sitemap": "^5.1.1",
"gatsby-plugin-styled-components": "^5.1.0",
"gatsby-source-filesystem": "^4.1.3",
"gatsby-source-wallabag": "^0.2.0",
"gatsby-transformer-sharp": "^4.1.0",
BradNut commented 3 years ago

@sviande You should just be able to change existingNodes.forEach(n => touchNode({ nodeId: n.id })) to existingNodes.forEach(n => touchNode(n)).

Maybe there's something else you have to change regarding plugins but using your code locally on sourceNodes while changing that one line fixes the error locally for me but still getting issues trying to adapt your plugin code into sourceNodes.

sviande commented 3 years ago

Thanks for the heads up. I've push and published a new version Gatsby v4 compatible.

https://www.npmjs.com/package/gatsby-source-wallabag/v/0.3.0 https://github.com/sviande/gatsby-source-wallabag/commit/ef5246017ce9d531cb0bbd946a6b0a5c1fcf66c7

BradNut commented 3 years ago

@sviande Stuck on source and transform nodes after I updated to 0.3.0: "gatsby-source-wallabag": "^0.3.0" With the same other dependency versions listed above.

Looking at your changes made in ef52460 you updated gatsby to "gatsby": "^3.0.0" whereas Gatsby in my dependencies is "gatsby": "^4.1.6",. Unsure if your plugin needs to also be on 4.0

Error:

npm run start

> project@1.0.0 start
> npm run develop

> project@1.0.0 develop
> cross-env gatsby develop --verbose -H 0.0.0.0

verbose set gatsby_log_level: "verbose"
verbose set gatsby_executing_command: "develop"
verbose loading local command from: /home/user/project/node_modules/gatsby/dist/commands/develop.js
verbose running command: develop

verbose Transition to "initializing"
success open and validate gatsby-configs, load plugins - 0.419s
success onPreInit - 0.003s
success initialize cache - 0.073s
success copy gatsby files - 0.033s
verbose Attaching functions to development server
success Compiling Gatsby Functions - 0.197s
success onPreBootstrap - 0.210s
verbose Creating 3 worker
verbose Transition to "initializingData"
success createSchemaCustomization - 0.057s
verbose Transition to "initializingData" > "sourcingNodes"
⠋ source and transform nodes

When I comment out my config for gatsby-source-wallabag inside my gatsby-config.js it proceeds with my builds. My config statement I commented out:

{
      resolve: `gatsby-source-wallabag`,
      options: {
        URL: process.env.WALLABAG_URL,
        clientID: process.env.WALLABAG_CLIENT_ID,
        clientSecret: process.env.WALLABAG_CLIENT_SECRET,
        username: process.env.WALLABAG_USERNAME,
        password: process.env.WALLABAG_PASSWORD,
      },
},
BradNut commented 3 years ago

@sviande Disregard this. It may have just been a slow connection on my part as the default request in the plugin is 500. Let me confirm.

sviande commented 3 years ago

I've push a new version 0.3.1, with a reporter showing you how many articles are fetched. There is no problem for me with gastby v4.

BradNut commented 3 years ago

Thank you for looking at it regardless.