Drizzle TeamDT
Drizzle Team3y ago
2 replies
locohost

Node app Typescrip drizzle-orm/libsql works fine in terminal, but errors running in Docker container

I've built a Node Express app with Typescript. I'm using Drizzle and TursoDb for the data stuff. Everything works peachy when I'm running the app in terminal. It also builds (tsc) and then the /dist version runs perfectly great.

However, when I build a Docker container and the app tries to run, I get an error on the drizzle-orm/libsql line in transpiled JS...

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.db = void 0;
const libsql_1 = require("drizzle-orm/libsql"); // <---- Errors on this line running in Docker container
const client_1 = require("@libsql/client");
const dotenv_1 = __importDefault(require("dotenv"));
dotenv_1.default.config();
let client;
// if (process.env.NODE_ENV == "production") {
console.log("Connected to Turso db");
client = (0, client_1.createClient)({
    url: process.env.DATABASE_URL,
    authToken: process.env.DATABASE_AUTH_TOKEN,
});
exports.db = (0, libsql_1.drizzle)(client);


This is error when Docker image runs...

> NODE_ENV=production && node dist/app.js

/home/node/app/node_modules/drizzle-orm/libsql/index.js:1
export * from "./driver.js";
^^^^^^

SyntaxError: Unexpected token export
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js 


Has anyone else experienced this? I'm certain its something dumb on my part. Ofc. Can anyone offer some advice to get this working in the Docker container?

Thank you for any help!
Was this page helpful?