-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(gatsby): open lmdb instances in writeable locations in generated ssr/dsg function #38631
Conversation
console.log(`Downloaded datastore from CDN`) | ||
} | ||
console.log(`Downloaded datastore from CDN`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unrelated to rest of changes, just noticed this was logged even if LMDB wasn't excluded from the bundle (so when it shouldn't be logged)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
@pieh Can we do a release for this fix? Having this issue in production version of code hosted on netlify |
cc @madhums |
Description
This makes
caches-lmdb
ANDgatsby-core-utils
getStorage
open lmdb cache/storage instances in writeable location (in case CWD in lambda environment is not writeable). The FS rewrites we have there now doesn't apply to LMDB (fs handling of lmdb is not in Node.js land) so we have to explicitly deal with "fs rewrite" when LMDB is concerned. We were already addressing this for main LMDB instance (datastore), but this expands it tocache
andstorage
usage of lmdb as well.gatsby-core-utils
is already usingglobal.__GATSBY.root
-gatsby/packages/gatsby-core-utils/src/utils/get-storage.ts
Lines 29 to 32 in 47ec2ac
This PR adds similar usage to lmdb cache usage, as well as actually sets the root to writeable location in lambda
Documentation
Tests
This is example showing segfault problem caused by trying to open LMDB in non-writeable location - https://6527cb3ca4fc76285774d547--exquisite-pavlova-cc785c.netlify.app/
https://6527d2acfad30e0085a57db2--exquisite-pavlova-cc785c.netlify.app/ this one is using changes from this PR showing it fixing the problem.
Related Issues
Fixes FRA-10
https://github.com/netlify/pillar-support/issues/724