s2
s2 copied to clipboard
libc version mismatch Node 18 - AWS Lambda
We ran into an issue when we updated to node 18 on AWS Lambda, the binary for node 18 in the node-s2-binaries bucket has been compiled with libc 2.29, whereas the nodejs18.x lambda container has 2.26 causing the following runtime error:
node:internal/modules/cjs/loader:1338
return process.dlopen(module, path.toNamespacedPath(filename));
^
Error: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /var/task/node_modules/@radarlabs/s2/lib/binding/Release/node-v108-linux-x64/s2.node)
at Module._extensions..node (node:internal/modules/cjs/loader:1338:18)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
at Object.<anonymous> (/var/task/node_modules/@radarlabs/s2/index.js:5:12)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12) {
code: 'ERR_DLOPEN_FAILED'
}
I've created an example repo reproducing the problem using the lambda docker container.
Currently the libc version mentioned in the node-pre-gyp versioning documentation isn't included in the package.json > binary > package_name property. I think it would be good to add this, I'll attempt to, and see what you think.
yeah, ideally we should be pinning the versions of all dependencies. give it a go and I'll help out where I can
Hi @jkao we're working around the issue at the moment by building it on a machine with x64 architecture and in a docker container that has a libc version that matches the version we need at runtime.
Then we copy the s2.node file into the ./node_modules/@radarlabs/s2/lib/binding/Release/node-v108-linux-x64/
directory before deploying.
I can add the libc to the node-pre-gyp package_name as I've suggested, but unless someone uploads all the different libc versions for node 18 to the binaries bucket you'll probably end up having to build it yourself anyway.
You can see an example of how we're building it in the linked example repo.