Closed tmilewski closed 5 years ago
It uses gatsby-source-contentful
s createRemoteFileNode to cache it, which stores in PROJECT_DIR/.cache/gatsby-source-filesystem
This will be cached when using gatsby-plugin-netlify-cache
, but all files get deleted when the gatsby cache is reset. (Which can happen more often as you would think)
I can see how this can be very bad for huge sites. SQIP and the new video transformer will use node_modules/.cache/XYZ
. We could make source-filesystem use that folder as well? Files won't be deleted on Gatsby cache reset and caching on netlify would even work without the netlify-cache plugin.
Thanks for the reply, @axe312ger!
The approach of saving it in node_modules/.cache/XYZ
would likely help. Long-term we might want to enable a simple command to clear the cache for each plugin as it might not be 100% clear where this data resides.
In the meantime, I don't know that the issue is that the cache is being reset. See below for the process:
rm -r .cache; yarn build
yields the following:
Starting to fetch data from Contentful
Fetching default locale
default locale is : en-US
contentTypes fetched 28
Updated entries 2343
Deleted entries 0
Updated assets 2929
Deleted assets 0
Fetch Contentful data: 11828.563ms
No cached files to be found.
🔌 2:16 in dotcom/ on develop
› ls -al .cache/gatsby-source-filesystem
gls: cannot access '.cache/gatsby-source-filesystem': No such file or directory
🔌 2:16 in dotcom/ on develop
› ls -al .cache/caches
total 0
drwxr-xr-x 18 tmilewski staff 576 Aug 14 09:41 ./
drwxr-xr-x 47 tmilewski staff 1504 Aug 14 09:41 ../
drwxr-xr-x 2 tmilewski staff 64 Aug 14 09:40 default-site-plugin/
drwxr-xr-x 2 tmilewski staff 64 Aug 14 09:40 dev-404-page/
drwxr-xr-x 2 tmilewski staff 64 Aug 14 09:40 gatsby-plugin-manifest/
drwxr-xr-x 2 tmilewski staff 64 Aug 14 09:40 gatsby-plugin-page-creator/
drwxr-xr-x 2 tmilewski staff 64 Aug 14 09:40 gatsby-plugin-purgecss/
drwxr-xr-x 2 tmilewski staff 64 Aug 14 09:40 gatsby-plugin-sass/
drwxr-xr-x 2 tmilewski staff 64 Aug 14 09:40 gatsby-plugin-sharp/
drwxr-xr-x 2 tmilewski staff 64 Aug 14 09:41 gatsby-plugin-sitemap/
drwxr-xr-x 2 tmilewski staff 64 Aug 14 09:40 gatsby-source-contentful/
drwxr-xr-x 2 tmilewski staff 64 Aug 14 09:40 gatsby-source-filesystem/
drwxr-xr-x 35 tmilewski staff 1120 Aug 14 09:41 gatsby-transformer-remark/
drwxr-xr-x 3 tmilewski staff 96 Aug 14 09:40 gatsby-transformer-sharp/
drwxr-xr-x 2 tmilewski staff 64 Aug 14 09:40 internal-data-bridge/
drwxr-xr-x 2 tmilewski staff 64 Aug 14 09:40 load-babel-config/
drwxr-xr-x 2 tmilewski staff 64 Aug 14 09:40 prod-404/
drwxr-xr-x 2 tmilewski staff 64 Aug 14 09:40 webpack-theme-component-shadowing/
🔌 2:16 in dotcom/ on develop
› ls -al .cache/caches/gatsby-source-filesystem
total 0
drwxr-xr-x 2 tmilewski staff 64 Aug 14 09:40 ./
drwxr-xr-x 18 tmilewski staff 576 Aug 14 09:41 ../
🔌 2:16 in dotcom/ on develop
› ls -al .cache/caches/gatsby-source-contentful
total 0
drwxr-xr-x 2 tmilewski staff 64 Aug 14 09:40 ./
drwxr-xr-x 18 tmilewski staff 576 Aug 14 09:41 ../
yarn build
yields the following, apparently with cached files:
Starting to fetch data from Contentful
Fetching default locale
default locale is : en-US
contentTypes fetched 28
Updated entries 0
Deleted entries 0
Updated assets 0
Deleted assets 0
Fetch Contentful data: 598.905ms
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’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. 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 sometimes have this issue as well, just my sites are not that huge so I can wait when this happens...
Stil... what does @gatsbyjs/inkteam think about changing the cache dir for createRemoteFileNode
to node_modules/.cache/...
?
That's something for v3: https://github.com/gatsbyjs/gatsby/issues/5880
Hey again!
It’s been 30 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 reopen 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!
Summary
I'm using the
gatsby-plugin-netlify-cache
plugin which, by default, caches the.cache
directory on Netlify. I've confirmed that it's successfully caching the appropriate data/directories, butgatsby-source-contentful
is still re-requesting all data from Contentful on every build.I noticed locally that I don't see any data from
gatsby-source-contentful
in.cache
, despite the data not being fully re-requested on every update/build.So, my simple question is, where is this data being stored, if not in
.cache
?Relevant information
Environment
File contents
gatsby-config.js
:package.json
: N/Agatsby-node.js
: Can't currently share.gatsby-browser.js
: N/Agatsby-ssr.js
: N/A