Scale3-Labs / langtrace

Langtrace 🔍 is an open-source, Open Telemetry based end-to-end observability tool for LLM applications, providing real-time tracing, evaluations and metrics for popular LLMs, LLM frameworks, vectorDBs and more.. Integrate using Typescript, Python. 🚀💻📊
https://langtrace.ai
GNU Affero General Public License v3.0
532 stars 53 forks source link

NextJS Error: Couldn't find any `pages` or `app` directory #249

Closed amarion35 closed 3 weeks ago

amarion35 commented 2 months ago

I'm installing the self-hosted version with kubernetes but I got the following logs in the langtrace-app pod:

The _prisma_migrations table does not exist. Proceeding to start the app.
> langtrace@0.1.0 predev
> npm run run-migrations && npm run create-clickhouse-db
> langtrace@0.1.0 run-migrations
> npx prisma migrate deploy
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "langtrace", schema "public" at "langtrace-postgres:5432"
2 migrations found in prisma/migrations
Applying migration `0_init`
Applying migration `20240804000535_modify_data_columns_expectedoutput_model`
The following migration(s) have been applied:
migrations/
  └─ 0_init/
    └─ migration.sql
  └─ 20240804000535_modify_data_columns_expectedoutput_model/
    └─ migration.sql

All migrations have been successfully applied.
> langtrace@0.1.0 create-clickhouse-db
> npx tsx scripts/create-clickhouse-db.ts
Creating Clickhouse DB if not exists...
5b4dca07-bb2a-441a-9062-ce724eee009b
> langtrace@0.1.0 dev
> next dev
  ▲ Next.js 14.2.5
  - Local:        http://localhost:3000
 ✓ Starting...
Attention: Next.js now collects completely anonymous telemetry regarding usage.
This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry
Error: > Couldn't find any `pages` or `app` directory. Please create one under the project root
    at findPagesDir (/app/node_modules/next/dist/lib/find-pages-dir.js:42:15)
    at initialize (/app/node_modules/next/dist/server/lib/router-server.js:75:69)
    at async Server.<anonymous> (/app/node_modules/next/dist/server/lib/start-server.js:249:36)
?25h
npm notice 
npm notice New minor version of npm available! 10.2.4 -> 10.8.2
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.8.2>;
npm notice Run `npm install -g npm@10.8.2` to update!
npm notice 

It looks like the app directory is missing. And indeed, according to the Dockerfile, the app directory is copied in the builder intermediate image but not copied from the builder to the production image.

karthikscale3 commented 2 months ago

Hi @amarion35 , thanks for reporting this. We will take a look and get back to you.

darshit-s3 commented 2 months ago

Hey @amarion35 , looks like you are running the client in dev mode.

amarion35 commented 2 months ago

To install langtrace I tried this guide: https://docs.langtrace.ai/hosting/hosting_options/kubernetes So the environment variables were the default ones except the AZURE ones.

Since it wasn't working, I tried to clone the repo, at the following tag 3.0.0. Then I added this line to the Dockerfile COPY --from=builder /app/app ./app, I built the image and it worked. The install worked and the pods seems to be running correctly but the app URL was unreachable. In the end I tried the docker compose option and it worked on the first try.

darshit-s3 commented 2 months ago

Hey @amarion35 , We have updated the helm chart with the default value of environment variable NEXT_PUBLIC_ENVIRONMENT set to production you should now not face this issue.

Give it a try and let us know. Thanks again for reporting.

The following are some helpful commands to re-install Langtrace helm if needed ```bash helm repo remove langtrace helm repo add langtrace https://Scale3-Labs.github.io/langtrace-helm-chart helm install langtrace langtrace/langtrace ```
FeU-aKlos commented 2 months ago

Hey @amarion35 , We have updated the helm chart with the default value of environment variable NEXT_PUBLIC_ENVIRONMENT set to production you should now not face this issue.

Give it a try and let us know. Thanks again for reporting. The following are some helpful commands to re-install Langtrace helm if needed

With the new helm chart i still run into an issue. I described it here

darshit-s3 commented 1 month ago

Hey @FeU-aKlos , thanks for reporting the issue. This as been fixed in the latest 3.0.4 release. You may pull the latest image and try again.

karthikscale3 commented 3 weeks ago

Closing this issue as it has been inactive. Please reopen if you see any this issue again.