gatsby icon indicating copy to clipboard operation
gatsby copied to clipboard

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

Open ZeldOcarina opened this issue 2 years ago • 8 comments

Preliminary Checks

  • [X] This issue is not a duplicate. Before opening a new issue, please search existing issues: https://github.com/gatsbyjs/gatsby/issues
  • [X] This issue is not a question, feature request, RFC, or anything other than a bug report directly related to Gatsby. Please post those things in GitHub Discussions: https://github.com/gatsbyjs/gatsby/discussions

Description

I am trying to start my development server and/or build the app and it gives TypeError: Cannot read properties of undefined (reading 'id')

Full error:

TypeError: Cannot read properties of undefined (reading 'id')
  
  - node-model.js:779 resolveRecursive
    [ncuc]/[gatsby]/src/schema/node-model.js:779:35
  
  - node-model.js:796 resolveRecursive
    [ncuc]/[gatsby]/src/schema/node-model.js:796:28
  
  - runMicrotasks
  
  - task_queues:96 processTicksAndRejections
    node:internal/process/task_queues:96:5
  
  - node-model.js:796 resolveRecursive
    [ncuc]/[gatsby]/src/schema/node-model.js:796:22
  
  - node-model.js:483 LocalNodeModel._doResolvePrepareNodesQueue
    [ncuc]/[gatsby]/src/schema/node-model.js:483:32
  
  - node-model.js:443 
    [ncuc]/[gatsby]/src/schema/node-model.js:443:11

Reproduction Link

https://github.com/ZeldOcarina/ncuc

Steps to Reproduce

  1. Clone the repo
  2. Make sure you have node 18.2.0 and npm 8.9.0
  3. run npm install and npm start

Expected Result

The repo builds

Actual Result

I keep getting this weird error, I've even added optional chainging on all the .id but without any result.

Environment

System:
    OS: macOS 12.4
    CPU: (8) arm64 Apple M1
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.2.0 - /opt/homebrew/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 8.9.0 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 103.0.5060.53
    Firefox: 101.0.1
    Safari: 15.5
  npmPackages:
    gatsby: ^4.18.0-next.2 => 4.18.0-next.2 
    gatsby-plugin-google-tagmanager: ^4.17.0 => 4.17.0 
    gatsby-plugin-image: ^2.17.0 => 2.17.0 
    gatsby-plugin-manifest: ^4.17.0 => 4.17.0 
    gatsby-plugin-offline: ^5.17.0 => 5.17.0 
    gatsby-plugin-react-helmet: ^5.17.0 => 5.17.0 
    gatsby-plugin-robots-txt: ^1.7.1 => 1.7.1 
    gatsby-plugin-sass: ^5.17.0 => 5.17.0 
    gatsby-plugin-sharp: ^4.17.0 => 4.17.0 
    gatsby-plugin-sitemap: ^5.17.0 => 5.17.0 
    gatsby-plugin-styled-components: ^5.17.0 => 5.17.0 
    gatsby-source-airtable: ^2.3.0 => 2.3.0 
    gatsby-source-filesystem: ^4.17.0 => 4.17.0 
    gatsby-transformer-remark: ^5.17.0 => 5.17.0 
    gatsby-transformer-sharp: ^4.17.0 => 4.17.0

Config Flags

No response

ZeldOcarina avatar Jun 30 '22 10:06 ZeldOcarina

Hi!

Please provide a minimal reproduction that one can run without having credentials for environment variables or content that is unrelated to the failure.

LekoArts avatar Jun 30 '22 11:06 LekoArts

I think this is related to AirTable so it's not so simple to create the reproduction!

ZeldOcarina avatar Jun 30 '22 14:06 ZeldOcarina

Right now I've noticed that if I keep cleaning and retrying after 6/7 attempts it goes through..

ZeldOcarina avatar Jun 30 '22 14:06 ZeldOcarina

Hey @ZeldOcarina!

Given the location of the error, I'd guess there's an issue in gatsby-source-airtable. If you're able to create a reproduction with a test environment you can share (as @LekoArts mentioned), we can take a look. I'd recommend filing an issue on the plugin side, as they will likely be more equipped to dig into the issue.

imjoshin avatar Jul 12 '22 14:07 imjoshin

Hi @j0sh77,

Thanks a lot!

I am not sure on how to reproduce this as it's dependent on having a lot of items and images to fetch. Right now I'm hosting this on a dedicated server and served with NGINX and I even had to put a node instance behind it to get functions going as it only builds on my local machine.

I tried DeployHQ, Netlify and Gatsby Cloud but it just fails everywhere for out of memory.. :(

On Vercel I always get that id error and on my local machine I sometimes get it, but sometimes the build goes through so then I can deploy the static assets via a shell script but that is not a great architecture as my team changes the CMS and I need to manually build and deploy every time..

ZeldOcarina avatar Jul 12 '22 15:07 ZeldOcarina

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

github-actions[bot] avatar Aug 02 '22 00:08 github-actions[bot]

I feel this still needs addressing. I've built two more HUGE websites in Gatsby and I had to completely ditch GatsbyImage as it was failing builds in all platforms (Gatsby Cloud, Vercel, Netlify, DeployHQ and even Jenkins on a dedicated server) and I could build only on my own local computer and push local files.

The problem was either this cryptic message or a JS heap issue, despite attempting all flags suggested by the team.

It's very hard for me to deliver a minimal reproduction but I can definitely give any needed secrets to spin the server up to the Gatsby team.

The last apps not using GatsbyImage build much faster but of course they do not score as well on Lighthouse due to images not perfectly optimized.

A hint at this issue might be Gatsby concurrent fetching or however is called. Since it's trying to process tens and tens of images at the same time it may result in the build error but currently there is NO way of turning it out according to another thread I read.

We plan to work long term and bring many many websites on Gatsby so we would love to have these small issues sorted out.

Thanks a lot!

ZeldOcarina avatar Aug 27 '22 07:08 ZeldOcarina

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

github-actions[bot] avatar Sep 17 '22 00:09 github-actions[bot]

Hey again!

It’s been 60 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to comment on this issue or create a new one if you need anything else. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks again for being part of the Gatsby community! 💪💜

github-actions[bot] avatar Oct 27 '22 00:10 github-actions[bot]