From c9f132d2b1d9f5b250580065213679fc2ebdd00a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Birm=C3=A9?= Date: Thu, 4 Jan 2024 20:49:53 +0100 Subject: [PATCH] fix: need to include fetch as we build for node 16 today --- src/plugins/utils.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/utils.ts b/src/plugins/utils.ts index 3012fb4..701993e 100644 --- a/src/plugins/utils.ts +++ b/src/plugins/utils.ts @@ -4,6 +4,7 @@ import { SubtitleTracks } from 'eyevinn-channel-engine'; import { Language, StitchPayload } from './interface'; +import fetch from 'node-fetch'; import { uuid } from 'uuidv4'; @@ -261,10 +262,14 @@ export function getVodUrlWithPreroll( } export async function resolveRedirect(url: string) { - const response = await fetch(url); - if (response.redirected) { - console.log('Redirect: ' + response.url); - return response.url || url; + try { + const response = await fetch(url); + if (response.redirected) { + console.log('Redirect: ' + response.url); + return response.url || url; + } + } catch (err) { + console.error(err); } return url; }