/lib64/libm.so.6: version `GLIBC_2.29' not found better-sqlite3

On interacting with the app after deployment am getting the below error

Error: 
/lib64/libm.so.6: version `GLIBC_2.29' not found 
(required by /var/task/node_modules/better-sqlite3/build/Release/better_sqlite3.node)
    at Module._extensions..node (node:internal/modules/cjs/loader:1340:18)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:121:18)
    at bindings (/var/task/node_modules/bindings/bindings.js:112:48)
    at new Database (/var/task/node_modules/better-sqlite3/lib/database.js:48:64)
    at new DB (/var/task/netlify/functions/api.js:51666:20)
    at Object.<anonymous> (/var/task/netlify/functions/api.js:51766:18)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)

How can I go about solving it? Is better-sqlite3 supported on netlify?

hi

Where is this error coming from? by interacting with your DSG pages?

We have an open issue around support for DSG on Netlify (the teams are working on this).

Thanks!

gualter thanks for your response. I have abandoned better-sqlite3 and replaced it with
Turso (libsql) which more aligns with Netlify serverless ideas. I have manage to get everything working locally using netlify dev. After deploying I am now getting the following error

Sep 29, 03:11:05 PM: INIT_START Runtime Version: nodejs:18.v12	Runtime Version ARN: arn:aws:lambda:us-east-1::runtime:0bdff101a7b4e0589af824f244deb93200e4663c2a8d7d0148b76cd00c48777a
Sep 29, 03:11:06 PM: 2023-09-29T19:11:06.041Z	undefined	ERROR	Uncaught Exception 	{"errorType":"Runtime.ImportModuleError","errorMessage":"Error: Cannot find module '@libsql/linux-x64-gnu'\nRequire stack:\n- /var/task/netlify/functions/api.js\n- /var/task/api.js\n- /var/runtime/index.mjs","stack":["Runtime.ImportModuleError: Error: Cannot find module '@libsql/linux-x64-gnu'","Require stack:","- /var/task/netlify/functions/api.js","- /var/task/api.js","- /var/runtime/index.mjs","    at _loadUserApp (file:///var/runtime/index.mjs:1061:17)","    at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1093:21)","    at async start (file:///var/runtime/index.mjs:1256:23)","    at async file:///var/runtime/index.mjs:1262:1"]}
Sep 29, 03:11:06 PM: 2023-09-29T19:11:06.525Z	undefined	ERROR	Uncaught Exception 	{"errorType":"Runtime.ImportModuleError","errorMessage":"Error: Cannot find module '@libsql/linux-x64-gnu'\nRequire stack:\n- /var/task/netlify/functions/api.js\n- /var/task/api.js\n- /var/runtime/index.mjs","stack":["Runtime.ImportModuleError: Error: Cannot find module '@libsql/linux-x64-gnu'","Require stack:","- /var/task/netlify/functions/api.js","- /var/task/api.js","- /var/runtime/index.mjs","    at _loadUserApp (file:///var/runtime/index.mjs:1061:17)","    at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1093:21)","    at async start (file:///var/runtime/index.mjs:1256:23)","    at async file:///var/runtime/index.mjs:1262:1"]}
Sep 29, 03:11:06 PM: Unknown application error occurred
Runtime.ImportModuleError
Sep 29, 03:11:06 PM: 3e1164a5 Duration: 502.40 ms	Memory Usage: 34 MB	

This is probably the important part from the above error

Error: Cannot find module '@libsql/linux-x64-gnu'

It looks like its the library for Turso which I have in package.json in the root folder
What else do I need to do to tell netlify I need this library?

I added this to the toml file and suddenly it started working on the deploy

[functions]
external_node_modules = [“@libsql/client”]

Do I need to manually add all the packages in package.json to toml? It seems repetitive

update: It seems I did not have to add any other files just this one. I have no idea why.

We are also not sure why but then we don’t know your code at all. Glad to hear you found a solution!