Repository: promptfoo/promptfoo
Issue: Self-Hosting via provided Dockerfile does not work
Root cause: Configuration Error

## Description
I am trying to set up a self-hosted Promptfoo instance on Azure. For this I simply cloned the source code, built the image and created a container. It seems however that the package.json of the web ui get mixed up with those of the package itself. The UI shows fine but the API behind it does not work. Either I misunderstood the definition of "self-hosted" or the Dockerfile is erroneous. 

## Steps to Reproduce
1. Build the image using the source code in this repo
2. Run a container based on the image
3. Run an evaluation via the UI

## Expected Behavior
The evaluation should run without any errors and produce the expected results.

## Actual Behavior
The evaluation does not run due to the following error: 

```
Error: Cannot find module 'better-sqlite3'
Require stack:
- /app/.next/server/app/api/eval/job/route.js
- /app/node_modules/next/dist/server/require.js
- /app/node_modules/next/dist/server/next-server.js
- /app/node_modules/next/dist/server/next.js
- /app/node_modules/next/dist/server/lib/render-server.js
- /app/node_modules/next/dist/compiled/jest-worker/processChild.js
[90m    at Module._resolveFilename (node:internal/modules/cjs/loader:1134:15)[39m
    at [90m/app/[39mnode_modules/[4mnext[24m/dist/server/require-hook.js:110:36
[90m    at Module._load (node:internal/modules/cjs/loader:975:27)[39m
[90m    at Module.require (node:internal/modules/cjs/loader:1225:19)[39m
[90m    at require (node:internal/modules/helpers:177:18)[39m
    at 85890 [90m(/app/[39m.next/server/app/api/eval/job/route.js:30:18[90m)[39m
    at __webpack_require__ [90m(/app/[39m.next/server/webpack-runtime.js:25:43[90m)[39m
    at 70992 [90m(/app/[39m.next/server/chunks/288.js:163:72[90m)[39m
    at __webpack_require__ [90m(/app/[39m.next/server/webpack-runtime.js:25:43[90m)[39m
    at 5811 [90m(/app/[39m.next/server/chunks/288.js:1592:16[90m)[39m {
  code: [32m'MODULE_NOT_FOUND'[39m,
  requireStack: [
    [32m'/app/.next/server/app/api/eval/job/route.js'[39m,
    [32m'/app/node_modules/next/dist/server/require.js'[39m,
    [32m'/app/node_modules/next/dist/server/next-server.js'[39m,
    [32m'/app/node_modules/next/dist/server/next.js'[39m,
    [32m'/app/node_modules/next/dist/server/lib/render-server.js'[39m,
    [32m'/app/node_modules/next/dist/compiled/jest-worker/processChild.js'[39m
  ]
}
```

## Additional Information
I sh'ed in the container and checked the installed npm modules, and it seems that only the ones in `src/web/nextui/package.json` are installed. I would expect that the self-hosted instance would at least deploy the functionalities, and optionally also this web ui.

Thank you for looking into this issue. I appreciate your help and guidance on resolving this problem.

Hi @SimonDahrs, thanks for the report.  It looks like the sqlite migration is causing an issue with self-hosting.  As a temporarily workaround, you can checkout tag 0.47.0 and build from that.

Fix in #568 

@typpo thanks for the quick fix, it works now! :)