prismicio / prismic-gatsby

Gatsby plugins for building websites using Prismic
https://prismic.io/docs/technologies/gatsby
Apache License 2.0
313 stars 97 forks source link

Cannot read properties of undefined (reading 'pick') #488

Closed heart-of-code closed 2 years ago

heart-of-code commented 2 years ago

Versions

Reproduction

Worked fine on version 4.1.6. Upgraded to 5.2.3 and this error started occurring. I'm not sure what else I can offer for reproduction steps, all I did was upgrade.

What is expected?

npm run build doesn't crash

What is actually happening?

success Building Rendering Engines - 16.529s
success Building HTML renderer - 6.138s
success Execute page configs - 0.044s
⠋ Validating Rendering Engines
error "gatsby-source-prismic" threw an error while running the createSchemaCustomization lifecycle:

Cannot read properties of undefined (reading 'pick')

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

  - index.js:351791 Object.createImgixGatsbyImageFieldConfig
    C:/Users/mattr/OneDrive/Documents/repos/torchlight.press/torchlight.press/gatsby/.cache/query-engine/index.js:351791:110

  - index.js:325874 Object.buildImgixGatsbyTypes
    C:/Users/mattr/OneDrive/Documents/repos/torchlight.press/torchlight.press/gatsby/.cache/query-engine/index.js:325874:74

  - index.js:323448 Object.createImgixGatsbyTypes
    C:/Users/mattr/OneDrive/Documents/repos/torchlight.press/torchlight.press/gatsby/.cache/query-engine/index.js:323448:26

  - index.js:302431
    C:/Users/mattr/OneDrive/Documents/repos/torchlight.press/torchlight.press/gatsby/.cache/query-engine/index.js:302431:164

  - index.js:308117
    C:/Users/mattr/OneDrive/Documents/repos/torchlight.press/torchlight.press/gatsby/.cache/query-engine/index.js:308117:103

  - index.js:308233
    C:/Users/mattr/OneDrive/Documents/repos/torchlight.press/torchlight.press/gatsby/.cache/query-engine/index.js:308233:151

  - index.js:309021
    C:/Users/mattr/OneDrive/Documents/repos/torchlight.press/torchlight.press/gatsby/.cache/query-engine/index.js:309021:116

  - index.js:309223
    C:/Users/mattr/OneDrive/Documents/repos/torchlight.press/torchlight.press/gatsby/.cache/query-engine/index.js:309223:44

failed Validating Rendering Engines - 1.001s

 ERROR #98001  WEBPACK

Built Rendering Engines failed validation failed validation.

Please open an issue with a reproduction at
https://github.com/gatsbyjs/gatsby/issues/new for more help

  Error: Worker exited before finishing task

  - index.js:112 ChildProcess.<anonymous>
    [gatsby]/[gatsby-worker]/dist/index.js:112:45

  - node:events:390 ChildProcess.emit
    node:events:390:28

  - child_process:290 Process.ChildProcess._handle.onexit
    node:internal/child_process:290:12

GitHub won't allow me to upload my package.json file for reference, so I've pasted it into a code block below:

{
  "name": "torchlightpress",
  "private": true,
  "description": "",
  "version": "1.0.0",
  "author": "Addison Short <addison@torchlight.press>",
  "dependencies": {
    "@auth0/auth0-react": "^1.8.0",
    "@n8tb1t/use-scroll-position": "^2.0.3",
    "@prismicio/client": "^5.1.0",
    "auth0-js": "^9.18.0",
    "billflow-react": "^1.1.1",
    "cross-env": "^7.0.3",
    "dotenv": "^10.0.0",
    "framer-motion": "^5.5.5",
    "gatsby": "^4.4.0",
    "gatsby-image": "^3.11.0",
    "gatsby-plugin-feed": "^4.4.0",
    "gatsby-plugin-gdpr-cookies": "^2.0.8",
    "gatsby-plugin-google-fonts": "^1.0.1",
    "gatsby-plugin-image": "^2.4.0",
    "gatsby-plugin-manifest": "^4.4.0",
    "gatsby-plugin-offline": "^5.4.0",
    "gatsby-plugin-react-helmet": "^5.4.0",
    "gatsby-plugin-sharp": "^4.4.0",
    "gatsby-plugin-snipcart-advanced": "^1.0.3",
    "gatsby-plugin-styled-components": "^5.4.0",
    "gatsby-source-filesystem": "^4.4.0",
    "gatsby-source-prismic": "^5.2.3",
    "gatsby-source-shopify": "^6.4.0",
    "gatsby-transformer-sharp": "^4.4.0",
    "lodash": "^4.17.21",
    "markdown-it": "^12.3.0",
    "md5": "^2.3.0",
    "npm-check-updates": "^12.0.5",
    "prop-types": "^15.7.2",
    "react": "^17.0.2",
    "react-cookie": "^4.1.1",
    "react-dom": "^17.0.2",
    "react-helmet": "^6.1.0",
    "react-hot-loader": "^4.13.0",
    "react-icons": "^4.3.1",
    "react-is": "^17.0.2",
    "react-pdf": "^5.6.0",
    "styled-components": "^5.3.3"
  },
  "keywords": [
    "gatsby"
  ],
  "license": "0BSD",
  "scripts": {
    "build": "cross-env GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=true gatsby build",
    "develop": "gatsby develop",
    "develop-ngrok": "ngrok http -subdomain=torchlightpress 8000",
    "start": "npm run develop",
    "serve": "gatsby serve",
    "clean": "gatsby clean",
    "test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "https://gitlab.com/torchlightpress/torchlight.press"
  },
  "bugs": {
    "url": "https://gitlab.com/torchlightpress/torchlight.press/-/issues"
  },
  "devDependencies": {
    "@babel/plugin-proposal-decorators": "^7.16.5",
    "babel-jest": "^27.4.5",
    "babel-plugin-styled-components": "^2.0.2",
    "babel-preset-gatsby": "^2.4.0",
    "gatsby-cli": "^4.4.0",
    "identity-obj-proxy": "^3.0.0",
    "jest": "^27.4.5",
    "react-test-renderer": "^17.0.2"
  }
}
cyberious commented 2 years ago

Having the same issue after working to get Prismic and Gatsby upgraded, working fine in dev mode but the build fails.

angeloashmore commented 2 years ago

Hey @heart-of-code and @cyberious sorry for the delay. I'm just getting back after some time off from work. :)

I'm looking into this today. It appears to be related to @imgix/gatsby (used for the gatsby-plugin-image integration).

@heart-of-code @cyberious Are either of you using Gatsby 4's new rendering strategies? DSG or SSR?

heart-of-code commented 2 years ago

no worries, I wasn't really expecting a response over the holidays 😁

I'm not using either of those new features. I also can share my codebase with you on GitLab if you have an account there

On Tue, Jan 4, 2022, 4:12 PM Angelo Ashmore @.***> wrote:

Hey @heart-of-code https://github.com/heart-of-code and @cyberious https://github.com/cyberious sorry for the delay. I'm just getting back after some time off from work. :)

I'm looking into this today. It appears to be related to @imgix/gatsby (used for the gatsby-plugin-image integration).

@heart-of-code https://github.com/heart-of-code @cyberious https://github.com/cyberious Are either of you using Gatsby 4's new rendering strategies? DSG or SSR?

— Reply to this email directly, view it on GitHub https://github.com/prismicio/prismic-gatsby/issues/488#issuecomment-1005173698, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACBRN7LEJNANFG35LTIPU7LUUNPCLANCNFSM5KPHW5FQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

angeloashmore commented 2 years ago

Thanks, no need to share your code (at least not for now). I thought this bug was limited to DSG/SSR, but I guess not!

I opened a PR to @imgix/gatsby that should fix this issue. Once it is merged + published, I'll publish an update here. Thanks for your patience as always.

Related PR: https://github.com/imgix/gatsby/pull/159

angeloashmore commented 2 years ago

The PR was merged to @imgix/gatsby that should fix this issue. Could everyone update to the latest versions to ensure the update is installed?

Thanks!

cyberious commented 2 years ago

I can confirm it resolved my issue.