spknetwork / video-encoder

5 stars 3 forks source link

when ENABLE_P2P is false (default), createJob() fails due to undefined libp2p object #18

Closed hiveuprss closed 2 years ago

hiveuprss commented 2 years ago

encoder.service.ts @419 attempts to retrieve the peerId like peerid: this.self.p2pService.libp2p.peerId.toB58String(). This call fails because libp2p is undefined since the default configuration sets the ENABLE_P2P flag to false.

A work-around is to set ENABLE_P2P environment variable to true.

Detailed logs:

jobInfo {"data":{"queueJob":{"reason":"JOB_AVAILABLE","job":{"id":"00ca0c23-db93-436d-b54e-ec9618dc41f0","status":"queued","created_at":"2022-07-07T00:30:22.373Z","last_pinged":null,"start_date":null,"completed_at":null,"input":{"format":null,"uri":"https://ipfs.3speak.tv/ipfs/bafybeibnihldwkbpo52iu3qgind3v7paclgbl5tm4kcevhyz6lfkavjtwe","size":80660927},"result":null,"sync":null,"storageMetadata":{"app":"3speak","key":"elielkenobi/qmsatnpb/video","type":"video"},"metadata":{"video_owner":"elielkenobi","video_permlink":"qmsatnpb"}}}}} { node_id: 'did:key:' } { id: '00ca0c23-db93-436d-b54e-ec9618dc41f0', status: 'queued', created_at: '2022-07-07T00:30:22.373Z', last_pinged: null, start_date: null, completed_at: null, input: { format: null, uri: 'https://ipfs.3speak.tv/ipfs/bafybeibnihldwkbpo52iu3qgind3v7paclgbl5tm4kcevhyz6lfkavjtwe', size: 80660927 }, result: null, sync: null, storageMetadata: { app: '3speak', key: 'elielkenobi/qmsatnpb/video', type: 'video' }, metadata: { video_owner: 'elielkenobi', video_permlink: 'qmsatnpb' } } ok TypeError: Cannot read property 'peerId' of undefined at EncoderService.createJob (/home/user/video-encoder/dist/modules/core/encoder.service.js:379:49) at GatewayClient.queueJob (/home/user/video-encoder/dist/modules/core/gatewayClient.service.js:34:49) at processTicksAndRejections (internal/process/task_queues.js:95:5)

vaultec81 commented 2 years ago

Will fix ASAP