Skip to content
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

Prebuilt binaries from version 5.0.3 do not work on the Node v12 docker image #1578

Closed
TPXP opened this issue Apr 14, 2022 · 5 comments
Closed

Comments

@TPXP
Copy link

TPXP commented Apr 14, 2022

Hello,

We're using sqlite3 in a project running with Node.JS 12. Since version 5.0.3, require('sqlite3') fails with a binary dependency error:

$ docker run --rm -it node:12 bash
# npm i sqlite3
[...]
+ sqlite3@5.0.3
added 104 packages from 140 contributors and audited 104 packages in 7.757s

5 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
# node
> a = require('sqlite3')
Uncaught:
Error: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /node_modules/sqlite3/lib/binding/napi-v6-linux-x64/node_sqlite3.node)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1057:18)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
> exit()
# npm i sqlite3@5.0.2
[...]
+ sqlite3@5.0.2
added 99 packages from 152 contributors, updated 1 package and audited 282 packages in 7.922s

6 packages are looking for funding
  run `npm fund` for details

found 5 high severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
# node
> a = require('sqlite3')
{
  Database: [Function: Database],
  Statement: [Function: Statement],
  Backup: [Function: Backup],
  OPEN_READONLY: 1,
  OPEN_READWRITE: 2,
  OPEN_CREATE: 4,
  OPEN_FULLMUTEX: 65536,
  OPEN_URI: 64,
  OPEN_SHAREDCACHE: 131072,
  OPEN_PRIVATECACHE: 262144,
  VERSION: '3.34.0',
  SOURCE_ID: '2020-12-01 16:14:00 a26b6597e3ae272231b96f9982c3bcc17ddec2f2b6eb4df06a224b91089fed5b',
  VERSION_NUMBER: 3034000,
  OK: 0,
  ERROR: 1,
  INTERNAL: 2,
  PERM: 3,
  ABORT: 4,
  BUSY: 5,
  LOCKED: 6,
  NOMEM: 7,
  READONLY: 8,
  INTERRUPT: 9,
  IOERR: 10,
  CORRUPT: 11,
  NOTFOUND: 12,
  FULL: 13,
  CANTOPEN: 14,
  PROTOCOL: 15,
  EMPTY: 16,
  SCHEMA: 17,
  TOOBIG: 18,
  CONSTRAINT: 19,
  MISMATCH: 20,
  MISUSE: 21,
  NOLFS: 22,
  AUTH: 23,
  FORMAT: 24,
  RANGE: 25,
  NOTADB: 26,
  cached: { Database: [Function: Database], objects: {} },
  verbose: [Function]
}
> 

Other known impacted environments: projects deployed to the Node.js 12.x environment on AWS ElasticBeanstalk.

@zebreus
Copy link

zebreus commented Apr 14, 2022

This seems to affect most node docker containers, independent of the node version. I tested node:16-alpine, node:12-alpine and node:16-busterand node-sqlite3 works on none of them.

Log:

root@9e7a7e288344:/tmp/tmp.uL9Zg24SVd# npm i sqlite3

added 104 packages, and audited 105 packages in 6s

5 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
npm notice
npm notice New minor version of npm available! 8.5.0 -> 8.6.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.6.0
npm notice Run npm install -g npm@8.6.0 to update!
npm notice
root@9e7a7e288344:/tmp/tmp.uL9Zg24SVd# node
Welcome to Node.js v16.14.2.
Type ".help" for more information.
> a = require("sqlite3")
Uncaught:
Error: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /tmp/tmp.uL9Zg24SVd/node_modules/sqlite3/lib/binding/napi-v6-linux-x64/node_sqlite3.node)
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1187:18)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18) {
  code: 'ERR_DLOPEN_FAILED'
}

@daniellockyer
Copy link
Member

It looks like node:12 in Docker uses Debian Stretch, which probably ships an older version of glibc. I've updated the build environment recently so we've probably regressed on support for older glibc versions.

In the mean time, you can stay on v5.0.2, compile sqlite3 from source or switch to 12-bullseye, which ships with glibc 2.31 🙂

@daniellockyer
Copy link
Member

@zebreus Linux musl prebuilt binaries was fixed in 8b2cdd9 and should be released soon 🙂

zebreus added a commit to zebreus/n8n that referenced this issue Apr 14, 2022
sqlite3@5.0.3 currently does not work with musl, which breaks the docker container build. This will probably be fixed quite soon, but until then sqlite@5.0.2 should be used.
Related sqlite3 issue: TryGhost/node-sqlite3#1578
daniellockyer added a commit that referenced this issue Apr 15, 2022
refs #1580
refs #1578

- it's difficult to know what version of glibc CI is building binaries
  compatible with, so this commit adds a step to print out the linked
  version after building
@daniellockyer
Copy link
Member

The fix for this should be out with 5.0.4 🙂

@daniellockyer
Copy link
Member

Released 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants