From 27f3710c8bd650301a357c7bce58e55455fe9a50 Mon Sep 17 00:00:00 2001 From: Nguyen Thanh Dat Date: Fri, 14 Aug 2026 07:57:49 +0700 Subject: [PATCH] fix(docker): ship sql.js so the pure-JS DB fallback can start Next file tracing follows JS imports, and sql.js loads dist/sql-wasm.wasm by path at runtime, so the standalone output carries the package's JS without its wasm binary. When both native drivers fail the last-resort adapter then aborts with ENOENT on the missing binary and the container never gets a database. The CLI bundle already guards this explicitly (build-cli.js step 3b, ensureModuleInBundle("sql.js")); the image just never got the same treatment. Copy the package the same way node-forge and next already are. Fixes #3248 --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index 5abe1f24..6e11dfe3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,6 +37,9 @@ COPY --from=builder /app/src/mitm ./src/mitm COPY --from=builder /app/node_modules/node-forge ./node_modules/node-forge # Ensure `next` is available at runtime in case tracing did not include it. COPY --from=builder /app/node_modules/next ./node_modules/next +# sql.js loads dist/sql-wasm.wasm by path at runtime; tracing only follows JS imports, +# so the last-resort DB driver would abort with ENOENT on the missing binary. +COPY --from=builder /app/node_modules/sql.js ./node_modules/sql.js RUN mkdir -p /app/data && chown -R node:node /app && \ mkdir -p /app/data-home && chown node:node /app/data-home && \