MarsHeer / offtiktokapi

Tiktok API wrapper written in TS for the Offtiktok.com client
https://offtiktok.com
22 stars 2 forks source link

Error when starting the Docker container #2

Closed TecnoCreeper closed 3 months ago

TecnoCreeper commented 3 months ago

OS: Windows 10 Docker Desktop with WSL2 backend.

Starting the container gives an error. I tried debugging but I don't know much about node projects.

Full console output of container from Docker Desktop:

2024-08-03 15:42:35 app-1  | 
2024-08-03 15:42:35 app-1  | > news-poc@1.0.0 start
2024-08-03 15:42:35 app-1  | > NODE_ENV=production npm install && npx prisma migrate deploy && tsc && node dist/index.js
2024-08-03 15:42:35 app-1  | 
2024-08-03 15:42:55 app-1  | 
2024-08-03 15:42:55 app-1  | added 288 packages, and audited 289 packages in 20s
2024-08-03 15:42:55 app-1  | 
2024-08-03 15:42:55 app-1  | 27 packages are looking for funding
2024-08-03 15:42:55 app-1  |   run `npm fund` for details
2024-08-03 15:42:55 app-1  | 
2024-08-03 15:42:55 app-1  | found 0 vulnerabilities
2024-08-03 15:42:56 app-1  | Environment variables loaded from .env
2024-08-03 15:42:56 app-1  | Prisma schema loaded from prisma/schema.prisma
2024-08-03 15:42:56 app-1  | Datasource "db": SQLite database "offtiktok.db" at "file:../prisma/offtiktok.db"
2024-08-03 15:42:57 app-1  | 
2024-08-03 15:42:57 app-1  | SQLite database offtiktok.db created at file:../prisma/offtiktok.db
2024-08-03 15:42:57 app-1  | 
2024-08-03 15:42:57 app-1  | 10 migrations found in prisma/migrations
2024-08-03 15:42:57 app-1  | 
2024-08-03 15:42:58 app-1  | Applying migration `20240721122741_initialize_db`
2024-08-03 15:42:59 app-1  | Applying migration `20240721133726_add_author_model`
2024-08-03 15:43:00 app-1  | Applying migration `20240724172138_add_post_descriptions`
2024-08-03 15:43:01 app-1  | Applying migration `20240724205716_add_user_handle`
2024-08-03 15:43:02 app-1  | Applying migration `20240726142114_improve_videos`
2024-08-03 15:43:03 app-1  | Applying migration `20240727001551_make_hls_and_thumb_optional`
2024-08-03 15:43:04 app-1  | Applying migration `20240730162029_add_originalurl`
2024-08-03 15:43:05 app-1  | Applying migration `20240730164220_add_deleted_field`
2024-08-03 15:43:06 app-1  | Applying migration `20240802072002_add_watch_sessions`
2024-08-03 15:43:07 app-1  | Applying migration `20240802072115_remove_expiry_from_sessions`
2024-08-03 15:43:08 app-1  | 
2024-08-03 15:43:08 app-1  | The following migration(s) have been applied:
2024-08-03 15:43:08 app-1  | 
2024-08-03 15:43:08 app-1  | migrations/
2024-08-03 15:43:08 app-1  |   └─ 20240721122741_initialize_db/
2024-08-03 15:43:08 app-1  |     └─ migration.sql
2024-08-03 15:43:08 app-1  |   └─ 20240721133726_add_author_model/
2024-08-03 15:43:08 app-1  |     └─ migration.sql
2024-08-03 15:43:08 app-1  |   └─ 20240724172138_add_post_descriptions/
2024-08-03 15:43:08 app-1  |     └─ migration.sql
2024-08-03 15:43:08 app-1  |   └─ 20240724205716_add_user_handle/
2024-08-03 15:43:08 app-1  |     └─ migration.sql
2024-08-03 15:43:08 app-1  |   └─ 20240726142114_improve_videos/
2024-08-03 15:43:08 app-1  |     └─ migration.sql
2024-08-03 15:43:08 app-1  |   └─ 20240727001551_make_hls_and_thumb_optional/
2024-08-03 15:43:08 app-1  |     └─ migration.sql
2024-08-03 15:43:08 app-1  |   └─ 20240730162029_add_originalurl/
2024-08-03 15:43:08 app-1  |     └─ migration.sql
2024-08-03 15:43:08 app-1  |   └─ 20240730164220_add_deleted_field/
2024-08-03 15:43:08 app-1  |     └─ migration.sql
2024-08-03 15:43:08 app-1  |   └─ 20240802072002_add_watch_sessions/
2024-08-03 15:43:08 app-1  |     └─ migration.sql
2024-08-03 15:43:08 app-1  |   └─ 20240802072115_remove_expiry_from_sessions/
2024-08-03 15:43:08 app-1  |     └─ migration.sql
2024-08-03 15:43:08 app-1  |       
2024-08-03 15:43:08 app-1  | All migrations have been successfully applied.
2024-08-03 15:43:11 app-1  | node:internal/modules/cjs/loader:1148
2024-08-03 15:43:11 app-1  |   throw err;
2024-08-03 15:43:11 app-1  |   ^
2024-08-03 15:43:11 app-1  | 
2024-08-03 15:43:11 app-1  | Error: Cannot find module '/usr/src/app/dist/index.js'
2024-08-03 15:43:11 app-1  |     at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
2024-08-03 15:43:11 app-1  |     at Module._load (node:internal/modules/cjs/loader:986:27)
2024-08-03 15:43:11 app-1  |     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
2024-08-03 15:43:11 app-1  |     at node:internal/main/run_main_module:28:49 {
2024-08-03 15:43:11 app-1  |   code: 'MODULE_NOT_FOUND',
2024-08-03 15:43:11 app-1  |   requireStack: []
2024-08-03 15:43:11 app-1  | }
2024-08-03 15:43:11 app-1  | 
2024-08-03 15:43:11 app-1  | Node.js v20.16.0
2036-01-01 00:00:00 
2001-01-01 00:00:00 xited with code 1
TecnoCreeper commented 3 months ago

Found the problem.

The dev and start scripts/commands in package.json specify the wrong path to index.js.

dist/index.js instead of just index.js

MarsHeer commented 3 months ago

@TecnoCreeper thanks for flagging this, I had accidentally dropped my "outDir" config from my .tsconfig

Pushed a fix :)