@@ -16,23 +16,27 @@ const RELOCATABLE_BINARIES = [
1616]
1717
1818/**
19- * Sadly we need to manually patch the bundle because the default build doesn't work on Lambda .
19+ * Manually patching the bundle to work around various incompatibilities in some versions .
2020 */
2121export const patchFile = async ( baseDir ) : Promise < void > => {
2222 /* eslint-disable no-template-curly-in-string */
2323 const replacements = [
24- // Gatsby puts its cache db in a location that is readonly in functions
24+ // Older versions of Gatsby put its cache db in a location that is readonly in functions
2525 [
2626 'process.cwd(), `.cache/${cacheDbFile}`' ,
2727 "require('os').tmpdir(), 'gatsby', `.cache/${cacheDbFile}`" ,
2828 ] ,
29- // If we're compiling on newer versions of Node, we need to use the binary that supports the older ABI version
29+ // If we're compiling on newer versions of Node, we need to use the binary that supports the older ABI version because lambda
3030 [
31- 'Object.assign(exports, require(__webpack_require__.ab + "prebuilds/linux-x64/node.abi93.node"))' ,
32- 'Object.assign(exports, require(__webpack_require__.ab + "prebuilds/linux-x64/node.abi83.node"))' ,
31+ 'require(__webpack_require__.ab + "prebuilds/linux-x64/node.abi93.node")' ,
32+ 'require(__webpack_require__.ab + "prebuilds/linux-x64/node.abi83.node")' ,
33+ ] ,
34+ // Newer versions of lmdb do this
35+ [
36+ 'require(__webpack_require__.ab + "prebuilds/linux-x64/node.abi93.glibc.node")' ,
37+ 'require(__webpack_require__.ab + "prebuilds/linux-x64/node.abi83.glibc.node")' ,
3338 ] ,
3439 ]
35-
3640 /* eslint-enable no-template-curly-in-string */
3741
3842 const bundleFile = join ( baseDir , '.cache' , 'query-engine' , 'index.js' )
0 commit comments