From af24c152a8bc9fb7fb6b9b53c63d7fb3ed77c73f Mon Sep 17 00:00:00 2001 From: Viet Huynh Date: Fri, 29 Sep 2023 05:44:00 +0700 Subject: [PATCH] throw error if required secrets have not been added --- lib/helpers.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/helpers.js b/lib/helpers.js index 702b4f3..84b4e8f 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -20,6 +20,12 @@ if (!globalThis.fetch) { * @returns {Promise} */ const request = async (url, options) => { + if (!API_TOKEN || !ACCOUNT_ID || !ACCOUNT_EMAIL) { + throw new Error( + "One or more required secrets have not been added: CLOUDFLARE_API_KEY, CLOUDFLARE_ACCOUNT_ID, and CLOUDFLARE_ACCOUNT_EMAIL" + ); + } + const response = await fetch(url, { headers: { Authorization: `Bearer ${API_TOKEN}`,