Cannot use libsql in production

Open
#3,593 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
deno, typescript
Domain
build-system

Research direction

The failure occurs in the built _fresh/server/server-entry.mjs when it cannot resolve @libsql/darwin-arm64; the report also links a reproduction repository. Read the build and server startup paths that bundle npm dependencies, then reproduce with deno task build and deno task start. Done means the reproduced libsql client starts successfully after a production build.

Written by the indexing model from the issue text.

Description

bug

I started a small project to experiment with fresh and certain packages I tend to use.
This also includes drizzle and using libsql as a database driver.
When using the vite dev-server (deno task dev) everything is fine. After running deno task build and starting the project (deno task start), I received this error:

Task start deno serve -A _fresh/server.js
error: Uncaught (in promise) Error: Cannot find module '@libsql/darwin-arm64'
Require stack:
- <path>/fresh-libsql/_fresh/server/server-entry.mjs
    at Module._resolveFilename (node:module:633:15)
    at Module._load (node:module:496:27)
    at Module.require (node:module:694:19)
    at require (node:module:828:16)
    at requireNative (file:///<path>/fresh-libsql/_fresh/server/server-entry.mjs:6359:10)
    at file:///<path>/fresh-libsql/_fresh/server/server-entry.mjs:6361:442

I created a repository to replicate & isolate the issue: https://github.com/DontMash/fresh-libsql
fresh: v2.1.4
deno: v2.5.4

Steps to reproduce:

  1. Setup a new fresh project

    deno run -Ar jsr:@fresh/init
    
  2. Add @libsql/client package

    deno add npm:@libsql/client
    
  3. Use the package to create a client

    ...
    const turso = createClient({
        url: "file:local.db",
    });
    ...
    
  4. Build the project

    deno task build
    
  5. Try running the project (will fail)

    deno task start
    
Dominant language
TypeScript
Stars
13.8k
Forks
757
Avg merge
3m
Merged PRs (30d)
2

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from freshframework/fresh

All issues in freshframework/fresh

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.