There seems to have been a regression and an error similar to the one reported in #16703 and fixed in #19288 is effected if markdownCaptions: true is specified in the gatsby-remark-images configuration within gatsby-config.js
The error is the same, but the reported call stack is a little different.
Create a new Gatsby site using gatsby-starter-blog:
gatsby new markdown-caption-repro https://github.com/gatsbyjs/gatsby-starter-blog
Run yarn upgrade
Specify markdownCaptions in the gatsby-remark-images block
resolve: `gatsby-remark-images`,
options: {
markdownCaptions: true,
maxWidth: 590,
showCaptions: true,
},
Run yarn develop
The page content should be generated and the development site should be available.
UNHANDLED REJECTION Cannot read property 'contentDigest' of undefined
TypeError: Cannot read property 'contentDigest' of undefined
- extend-node-type.js:59 htmlAstCacheKey
[narkdown-caption-repro]/[gatsby-transformer-remark]/extend-node-type.js:59:87
- extend-node-type.js:318 getHTMLAst
[narkdown-caption-repro]/[gatsby-transformer-remark]/extend-node-type.js:318:41
- extend-node-type.js:343 Object.getHTML [as generateHTML]
[narkdown-caption-repro]/[gatsby-transformer-remark]/extend-node-type.js:343:27
- index.js:150 getImageCaption
[narkdown-caption-repro]/[gatsby-remark-images]/index.js:150:21
- index.js:301 generateImagesAndUpdateNode$
[narkdown-caption-repro]/[gatsby-remark-images]/index.js:301:52
not finished run queries - 1.251s
not finished Generating image thumbnails - 1.383s
System:
OS: Windows 10 10.0.17763
CPU: (4) x64 Intel(R) Celeron(R) N4100 CPU @ 1.10GHz
Binaries:
Node: 12.11.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.21.0 - ~\AppData\Roaming\npm\yarn.CMD
npm: 6.11.3 - C:\Program Files\nodejs\npm.CMD
Languages:
Python: 2.7.16 - /c/Programs/Python27/python
Browsers:
Edge: 44.17763.831.0
npmPackages:
gatsby: ^2.18.4 => 2.18.7
gatsby-image: ^2.2.34 => 2.2.34
gatsby-plugin-feed: ^2.3.22 => 2.3.23
gatsby-plugin-google-analytics: ^2.1.29 => 2.1.29
gatsby-plugin-manifest: ^2.2.30 => 2.2.31
gatsby-plugin-offline: ^3.0.24 => 3.0.27
gatsby-plugin-react-helmet: ^3.1.16 => 3.1.16
gatsby-plugin-sharp: ^2.3.4 => 2.3.5
gatsby-plugin-typography: ^2.3.18 => 2.3.18
gatsby-remark-copy-linked-files: ^2.1.31 => 2.1.31
gatsby-remark-images: ^3.1.34 => 3.1.35
gatsby-remark-prismjs: ^3.3.25 => 3.3.25
gatsby-remark-responsive-iframe: ^2.2.28 => 2.2.28
gatsby-remark-smartypants: ^2.1.17 => 2.1.17
gatsby-source-filesystem: ^2.1.39 => 2.1.40
gatsby-transformer-remark: ^2.6.38 => 2.6.39
gatsby-transformer-sharp: ^2.3.6 => 2.3.7
I can confirm this is still broken.
It looks like https://github.com/gatsbyjs/gatsby/pull/19288 didn't completely fix the problem, since we make a call to getHTMLAst which immediately encounters the same problem.
Even if we were to use the same check one level deeper, we would just encounter the problem again on the next level.
It seems like this might have just gotten a bit messy, and could possibly use some re-thinking around what should be cached and what shouldn't. Maybe markdownNode itself could carry a shouldCache property to avoid doing checks at each level?
Another thing to consider is that the tests in gatsby-remark-images didn't catch this, since the problematic piece of code is mocked out.
Any idea what version this regression started?
Unfortunately not. I only started using Gatsby on Sunday - two days ago. And I'm assuming that it was a regression, as there was no mention of #19288 not solving the problem.
@wardpeet fwiw I don't think this is necessarily a regression, at least not a recent one - I think https://github.com/gatsbyjs/gatsby/pull/19288 just didn't solve the problem.
I'm also fairly new to gatsby, but it might be the case that this never worked as intended?
Hiya!
This issue has gone quiet. Spooky quiet. 馃懟
We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 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. You can also add the label "not stale" to keep this issue open!
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! 馃挭馃挏
I guess the "not stale" label mentioned ^ is warranted here.
Hiya!
This issue has gone quiet. Spooky quiet. 馃懟
We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 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. You can also add the label "not stale" to keep this issue open!
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! 馃挭馃挏
I guess the "not stale" label mentioned ^ is warranted here.
Can confirm that this is still an issue on latest version of gatsby-remark-images if you set markdownCaptions: true.
Hiya!
This issue has gone quiet. Spooky quiet. 馃懟
We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 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. You can also add the label "not stale" to keep this issue open!
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! 馃挭馃挏
Using v3.1.44, same issue :/
Same issue in v3.1.46..
Who owns this code and can help move it forward, @wardpeet? We're hitting this problem too with a blog that has a lot of captions and don't really have a way around it.
Who owns this code and can help move it forward, @wardpeet? We're hitting this problem too with a blog that has a lot of captions and don't really have a way around it.
Hi, I've been waiting for a week and made some changes finally by myself. I've just sent a PR #22256, we will see if it can be merged up, or someone may have a better solution
CC @mathieudutour
Most helpful comment
Hi, I've been waiting for a week and made some changes finally by myself. I've just sent a PR #22256, we will see if it can be merged up, or someone may have a better solution