tursodatabase / libsql-js

A better-sqlite3 compatible API for libSQL that supports Bun, Deno, and Node
MIT License
191 stars 22 forks source link

Error relocating @libsql/linux-x64-musl/index.node: fcntl64: symbol not found #91

Closed DmitryScaletta closed 3 weeks ago

DmitryScaletta commented 6 months ago

I use fastify, turso and drizzle-orm. It works fine locally on my windows machine.

I'm trying to deploy my app to koyeb.com (they have AMD EPYC CPU).

Dockerfile

FROM node:18-alpine AS deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN corepack enable
RUN corepack prepare pnpm@latest --activate
RUN pnpm i --frozen-lockfile

FROM node:18-alpine AS builder
WORKDIR /app
COPY . .
COPY --from=deps /app/node_modules ./node_modules
RUN npm run build

FROM node:18-alpine AS runner
WORKDIR /usr/app
COPY --from=builder /app/dist ./dist
COPY package.json ./
RUN npm i --omit=dev
USER node
ENV NODE_ENV="production"
CMD ["npm", "start"]

tsconfig.json https://github.com/fastify/tsconfig/blob/master/tsconfig.json

After running npm start I get this error:

Error: Error relocating /usr/app/node_modules/@libsql/linux-x64-musl/index.node: fcntl64: symbol not found
    at Module._extensions..node (node:internal/modules/cjs/loader:1452:18)
    at Module.load (node:internal/modules/cjs/loader:1197:32)
    at Module._load (node:internal/modules/cjs/loader:1013:12)
    at Module.require (node:internal/modules/cjs/loader:1225:19)
    at require (node:internal/modules/helpers:177:18)
    at Object.<anonymous> (/usr/app/node_modules/libsql/index.js:42:5)
    at Module._compile (node:internal/modules/cjs/loader:1356:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
    at Module.load (node:internal/modules/cjs/loader:1197:32)
    at Module._load (node:internal/modules/cjs/loader:1013:12) {
  code: 'ERR_DLOPEN_FAILED'
}

Same error with 18-alpine, 20-alpine, 21-alpine and npm/pnpm

UPD. Downgrading @libsql/client to 0.4.3 worked for me Related issue: https://discord.com/channels/933071162680958986/1214203500939186186

lovell commented 6 months ago

See also https://github.com/tursodatabase/libsql-client-ts/issues/180 (which is currently closed, but the problem remains).

LucioFranco commented 3 weeks ago

This is solved by the latest release v0.4.3