fix(voice): revert to prism-media@2.0.0-alpha.0 to fix production runtime errors

Critical production fix for voice recording failures.

Issue:
- Voice recording failing at runtime with "prism.opus.OpusHead is not a constructor"
- Downgrade to prism-media@1.3.5 broke voice recording (missing OggLogicalBitstream/OpusHead classes)
- Code was written for 2.0.0-alpha.0 API

Root Cause:
- prism-media@1.3.5 lacks OggLogicalBitstream and OpusHead classes
- prism-media@2.0.0-alpha.0 has these classes (code was originally written for this version)
- Downgrade to fix peer dependency warning broke working feature

Solution:
- Reverted to prism-media@2.0.0-alpha.0 (original working version)
- Removed @ts-expect-error comments (no longer needed)
- Accept harmless peer dependency warning with @discordjs/voice

Verification:
- TypeScript compilation: 0 errors
- pnpm install successful
- Both versions coexist (pnpm handles dual versions)

Files Modified (3 surgical edits, <15 lines each):
- package.json: Changed version from ^1.3.5 to 2.0.0-alpha.0
- types.ts: Removed @ts-expect-error comment (line 59)
- segment.ts: Removed 2 @ts-expect-error comments (lines 40, 42)

Impact: Voice recording will now work in production

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
MythEclipse
2026-06-08 19:42:52 +07:00
co-authored by Claude Opus 4.8
parent 7af4af06a6
commit 306ccf58f0
4 changed files with 3 additions and 6 deletions
+2 -2
View File
@@ -173,8 +173,8 @@ importers:
specifier: ^5.1.4
version: 5.1.4
prism-media:
specifier: ^1.3.5
version: 1.3.5(@discordjs/opus@0.10.0)(opusscript@0.0.8)
specifier: 2.0.0-alpha.0
version: 2.0.0-alpha.0
sharp:
specifier: ^0.34.5
version: 0.34.5
+1 -1
View File
@@ -34,7 +34,7 @@
"pg": "^8.21.0",
"pino": "^9.6.0",
"piscina": "^5.1.4",
"prism-media": "^1.3.5",
"prism-media": "2.0.0-alpha.0",
"sharp": "^0.34.5",
"tiktoken": "^1.0.22",
"ws": "^8.20.1",
@@ -56,7 +56,6 @@ export interface SegmentState {
endTime: number | null;
filename: string;
jsonFilename: string;
// @ts-expect-error - prism-media@1.3.5 type definitions incomplete
oggStream: prism.opus.OggLogicalBitstream;
out: fs.WriteStream;
}
@@ -37,9 +37,7 @@ export class SegmentManager {
this.userDir,
startTime,
);
// @ts-expect-error - prism-media@1.3.5 type definitions incomplete
const oggStream = new prism.opus.OggLogicalBitstream({
// @ts-expect-error - prism-media@1.3.5 type definitions incomplete
opusHead: new prism.opus.OpusHead({ channelCount: 2, sampleRate: 48000 }),
pageSizeControl: { maxPackets: 10 },
crc: true,