libsql-client-ts: strcpy_chk: symbol not found
I’m trying to package my API into a docker image, using node:20-alpine.
Running my app leads to
2024-02-17T11:15:12.739 app[080e513b19e298] ams [info] node:internal/modules/cjs/loader:1473
2024-02-17T11:15:12.739 app[080e513b19e298] ams [info] return process.dlopen(module, path.toNamespacedPath(filename));
2024-02-17T11:15:12.739 app[080e513b19e298] ams [info] ^
2024-02-17T11:15:12.739 app[080e513b19e298] ams [info] Error: Error relocating /app/node_modules/@libsql/linux-x64-musl/index.node: __strcpy_chk: symbol not found
2024-02-17T11:15:12.739 app[080e513b19e298] ams [info] at Module._extensions..node (node:internal/modules/cjs/loader:1473:18)
2024-02-17T11:15:12.739 app[080e513b19e298] ams [info] at Module.load (node:internal/modules/cjs/loader:1207:32)
2024-02-17T11:15:12.739 app[080e513b19e298] ams [info] at Module._load (node:internal/modules/cjs/loader:1023:12)
2024-02-17T11:15:12.739 app[080e513b19e298] ams [info] at Module.require (node:internal/modules/cjs/loader:1235:19)
2024-02-17T11:15:12.739 app[080e513b19e298] ams [info] at require (node:internal/modules/helpers:176:18)
2024-02-17T11:15:12.739 app[080e513b19e298] ams [info] at Object.<anonymous> (/app/node_modules/libsql/index.js:41:24)
2024-02-17T11:15:12.739 app[080e513b19e298] ams [info] at Module._compile (node:internal/modules/cjs/loader:1376:14)
2024-02-17T11:15:12.739 app[080e513b19e298] ams [info] at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
2024-02-17T11:15:12.739 app[080e513b19e298] ams [info] at Module.load (node:internal/modules/cjs/loader:1207:32)
2024-02-17T11:15:12.739 app[080e513b19e298] ams [info] at Module._load (node:internal/modules/cjs/loader:1023:12) {
2024-02-17T11:15:12.739 app[080e513b19e298] ams [info] code: 'ERR_DLOPEN_FAILED'
2024-02-17T11:15:12.739 app[080e513b19e298] ams [info] }
It might be an issue with glibc/musl. See this issue
Do the libsql team have an opinion of what type of distribution I should use?
Dockerfile
FROM node:20-alpine as base
WORKDIR /app
COPY ./dist /app/dist
ARG GIT_SHA
ENV GIT_REVISION=$GIT_SHA
RUN npm install @libsql/client
EXPOSE 4000
CMD [ "node", "--no-warnings=ExperimentalWarning", "dist/index.js" ]
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 27 (4 by maintainers)
Commits related to this issue
- Revert "Bump `@neon-rs/cli`" This reverts commit e325e782a029f114aad8b1b85a675ea90152ec9c, which is suspected to cause problems with musl: https://github.com/tursodatabase/libsql-client-ts/issues/18... — committed to tursodatabase/libsql-js by penberg 3 years ago
- Downgrade @libsql/client to v0.4.3 until https://github.com/tursodatabase/libsql-client-ts/issues/180 waiting for fix — committed to jot-it/jotter by BrianUribe6 3 years ago
- Downgrade @libsql/client to v0.4.3 until https://github.com/tursodatabase/libsql-client-ts/issues/180 waiting for fix — committed to jot-it/jotter by BrianUribe6 3 years ago
- update libsql client fix hanging querings needed to switch image base because of https://github.com/tursodatabase/libsql-client-ts/issues/180 — committed to nichtsam/nichtsam.com by nichtsam 2 years ago
- update libsql client fix hanging querings needed to switch image base because of https://github.com/tursodatabase/libsql-client-ts/issues/180 — committed to nichtsam/nichtsam.com by nichtsam 2 years ago
- update libsql client fix hanging querings needed to switch image base because of https://github.com/tursodatabase/libsql-client-ts/issues/180 — committed to nichtsam/nichtsam.com by nichtsam 2 years ago
- update libsql client fix hanging querings needed to switch image base because of https://github.com/tursodatabase/libsql-client-ts/issues/180 — committed to nichtsam/nichtsam.com by nichtsam 2 years ago
- Revert "Bump `@neon-rs/cli`" This reverts commit e325e782a029f114aad8b1b85a675ea90152ec9c, which is suspected to cause problems with musl: https://github.com/tursodatabase/libsql-client-ts/issues/18... — committed to tursodatabase/libsql-js by penberg 3 years ago
Thanks for the updates, the
fcntl64: symbol not founderror remains with the new version when testing with latest Alpine Edge:The
fcntl64symbol is glibc-only and was introduced in glibc 2.28.v0.4.3 of
libsqlis out so if you run an npm update you should pick it up and should solve both the strcpy issue and the recent fcntl64 issues.@RA9 This problem remains and now there are duplicate reports appearing e.g. https://github.com/tursodatabase/libsql-js/issues/91
The summary is that the
@libsql/linux-x64-muslpackage provided from v0.3.1 onwards, including the latest v0.3.10, does not work on musl-based systems.I did some digging it looks like there were some larger issues with our Rust/C code that we built the js library (which TS uses). This PR should fix those issues and subsequent TS/Js issues https://github.com/tursodatabase/libsql/pull/1724
As a workaround we downgrading from
v5.xtov0.4.3tested to work withnode:18-alpineandnode:20-alpine(at least for now)It’s a workaround, but not a solution. Bookworm, bullseye or even distroless images work but are consuming more RAM compare to Alpine (15/20% more). In environment where you want to control cost on memory usage, Alpine is still the most optimised.
PS: You can probably use
slimrather than the wholebookwormas wellTried, but did not work 😕
@LukaGiorgadze not sure if it works for your setup, but I am using yarn v3 and as such can ensure I am using a version of libsql that works with alpine by adding this to the root package.json of my monorepo.
For npm-users i guess
overridesshould be the equivalent -> https://docs.npmjs.com/cli/v10/configuring-npm/package-json#overridesHey @penberg, should this issue be reopened? It doesn’t seem like the above proposed fix actually solved whatever the issue is for musl builds 😕
@flexchar That is my understanding, yes, but I’m only the messenger here. You’ll need to ask one of the maintainers about the future possible re-introduction of support for musl-based Linux.
Ran into this problem while trying to build a astro application with the db integration. Wont build using node:lts-alpine
Thanks for looking into this, @lovell! Unfortunately, the
@neon-rs/clibump was not related to the problem. Instead it’s this libsql issue related to the new encryption feature: https://github.com/tursodatabase/libsql/issues/1155