simonswiss / epic-stack-with-keystatic

An example of the Epic Stack with Keystatic
MIT License
7 stars 0 forks source link

test:e2e:run fails with `lru-cache` error #1

Open isaacplmann opened 6 months ago

isaacplmann commented 6 months ago

I've set up the repo so that npm run build works, but when I run npm run validate, it fails on the test:e2e:run step.

Steps to reproduce:

  1. Clone the repo
  2. Copy .env.default to .env
  3. Run npm run setup
  4. Run npm run build
  5. Run npm run validate (Or npm run test:e2e:run)

Error message:

> test:e2e:run
> cross-env CI=true playwright test

[WebServer] 
> start:mocks
> cross-env NODE_ENV=production MOCKS=true tsx .

[WebServer] 🔶 Mock server installed
[WebServer] SyntaxError: The requested module 'lru-cache' does not provide an export named 'default'
[WebServer] /Users/isaac/Documents/code/epic-web-examples/epic-stack-with-keystatic/build/server/assets/server-build-DjeGgzJ1.js:64
import LRU, { LRUCache } from "lru-cache";
       ^

SyntaxError: The requested module 'lru-cache' does not provide an export named 'default'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:131:21)
    at ModuleJob.run (node:internal/modules/esm/module_job:213:5)
    at ModuleLoader.import (node:internal/modules/esm/loader:316:24)
    at getBuild (file:///Users/isaac/Documents/code/epic-web-examples/epic-stack-with-keystatic/server/index.ts:202:4)
    at file:///Users/isaac/Documents/code/epic-web-examples/epic-stack-with-keystatic/server/index.ts:216:34

Error: Process from config.webServer was not able to start. Exit code: 1

ERROR: "test:e2e:run" exited with 1.

Node version: 20.9.0 Npm version: 10.5.0

Let me know if there's something else, you'd need from me to reproduce this. Thanks!

simonswiss commented 6 months ago

Hey!

I can reproduce this. A PR has just been merged in Keystatic core to upgrade the version of lru-cache (which in turn imports the named export instead of default export.

When this gets released, I'll update the Keystatic dependency in this project and this should fix it 🤙

simonswiss commented 6 months ago

Welp, I pressed enter and the new cut of Keystatic appeared 🎉

🦋  success packages published successfully:
🦋  @keystatic/core@0.5.11
🦋  @keystatic/templates-astro@0.0.23
🦋  @keystatic/templates-nextjs@0.0.24
🦋  @keystatic/templates-remix@0.0.11
simonswiss commented 6 months ago

Ok, this fixed the issue, but uncovered another one:

Error: No user found in root loader, but user is required by useUser. If user is optional, try useOptionalUser instead.

I gotta step away from the computer for a bit to drive my kids, but I'll get round to it soon 🤙