Gatsby: Problem with gatsby-transformer-json?

Created on 4 Oct 2018  ·  11Comments  ·  Source: gatsbyjs/gatsby

Description

Gatsby JSON transformer fails even with correct config.
I used the same configuration as on https://www.npmjs.com/package/gatsby-transformer-json.
I tried this with gatsbygram and the transformer works there, am i missing something here?

Steps to reproduce

  • Clone https://github.com/kartik2406/gatsby-json-test
  • run gatsby develop
  • Observe that you get following error and dev server does not even start
    Plugin gatsby-transformer-json returned an error TypeError: createContentDigest is not a function

Expected result

What should happen?
Gatsby server should start, should be able to retrieve data from json.

Actual result

Gatsby server fails.

What happened.
Gatsby tranformer json fails

Environment

Ubuntu 16.04

System:
OS: Linux 4.15 Ubuntu 16.04.5 LTS (Xenial Xerus)
CPU: x64 Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz
Shell: 5.1.1 - /usr/bin/zsh
Binaries:
Node: 8.11.4 - ~/.nvm/versions/node/v8.11.4/bin/node
Yarn: 1.10.1 - /usr/bin/yarn
npm: 5.6.0 - ~/.nvm/versions/node/v8.11.4/bin/npm
Browsers:
Chrome: 69.0.3497.100
Firefox: 62.0
npmPackages:
gatsby: ^2.0.0 => 2.0.2
gatsby-plugin-manifest: ^2.0.2 => 2.0.2
gatsby-plugin-offline: ^2.0.5 => 2.0.5
gatsby-plugin-react-helmet: ^3.0.0 => 3.0.0
gatsby-source-filesystem: ^2.0.1 => 2.0.1
gatsby-transformer-json: ^2.1.3 => 2.1.3
npmGlobalPackages:
gatsby-cli: 2.4.1

maintenance

All 11 comments

I have been using gatsby-transformer-json 2.1.2 which works fine. After upgrading to 2.1.3 I get this

error Plugin gatsby-transformer-json returned an error 
TypeError: createContentDigest is not a function

I have rolled back to 2.1.2 for now

Oh you also need to upgrade core gatsby.

We should upgrade the peerDependency of transformer-json

Thanks everyone :smile: I updated gatsby and gatsby-transformer-json packages and now everything works fine.

Closed with #8804

Hi sir, this project how run, please help me

On Fri, Oct 5, 2018, 11:52 AM Darpan Kakadia notifications@github.com
wrote:

Closed with #8804 https://github.com/gatsbyjs/gatsby/pull/8804


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/gatsbyjs/gatsby/issues/8794#issuecomment-427258663,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AnGQrkThKzzA9cb9VwYfjmJvAPPDA198ks5uhvqggaJpZM4XIWqy
.

@psnaik just run:

npm update gatsby && npm update gatsby-transformer-json

I'm experiencing problems with this plugin as well. My gatsby-config has nothing out of the ordinary in it:

{
  resolve: 'gatsby-transformer-json',
  options: {
    typeName: 'Json',
  },
},

gatsby develop crashes out with this message:

success copy gatsby files — 0.026 s
success onPreBootstrap — 0.010 s
error Plugin gatsby-transformer-json returned an error


  TypeError: createContentDigest is not a function

  - gatsby-node.js:51 transformObject

... many further warnings...

success source and transform nodes — 0.129 s
success building schema — 0.204 s
success createPages — 0.001 s
error Cannot read property 'filter' of undefined


  TypeError: Cannot read property 'filter' of undefined

If I remove all json files from my data directory the app will start (kinda defeats the purpose though!). Even a json file with just {} or [] in it causes this error.

Any suggestions would be great.

I've upgraded to gatsby 2.4.2 and v2.1.4 of the plugin.

@Vazerthon can you open a new issue with a reproduction repo and environment information?

Thanks @kakadiadarpan, have done.

Hi there, I have just run

yarn upgrade gatsby && yarn upgrade gatsby-transformer-json

and I get the following errors when trying to run gatsby deploy

error Plugin gatsby-transformer-json returned an error


  TypeError: createContentDigest is not a function

  - gatsby-node.js:51 transformObject
    [gatsby-2-0]/[gatsby-transformer-json]/gatsby-node.js:51:26

  - gatsby-node.js:74 parsedContent.forEach
    [gatsby-2-0]/[gatsby-transformer-json]/gatsby-node.js:74:9

  - Array.forEach

and further down...

error UNHANDLED REJECTION


  TypeError: Cannot read property 'filter' of undefined

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

Just as before I had no error before upgrading gatsby-transformer-json

Is there any more information I can provide to help resolve this issue

Was this page helpful?
0 / 5 - 0 ratings