From 801cabdce930265f6ca7ce8d9f0f1bbd56698270 Mon Sep 17 00:00:00 2001 From: Maria-Aidarus Date: Wed, 29 Nov 2023 12:22:24 +0300 Subject: [PATCH] changed the structure of the imports --- netlify/functions/handleMetadata.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/netlify/functions/handleMetadata.js b/netlify/functions/handleMetadata.js index f1196f6..85974e8 100644 --- a/netlify/functions/handleMetadata.js +++ b/netlify/functions/handleMetadata.js @@ -3,13 +3,14 @@ const { Configuration, OpenAIApi } = require('openai'); // const fetch = require('node-fetch'); -let fetch; +// let fetch; -async function loadFetch() { - if (!fetch) { - fetch = (await import('node-fetch')).default; - } -} +// async function loadFetch() { +// if (!fetch) { +// fetch = (await import('node-fetch')).default; +// } +// } +const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args)); // Function to fetch content from URL using a web scraping service async function fetchContentFromURL(url) {