From 4bba0ae7c11f5acc39f4cb86760506c1a296086d Mon Sep 17 00:00:00 2001 From: Shea McKinney Date: Wed, 9 Oct 2024 11:25:30 -0700 Subject: [PATCH] NoJira: Use preview key in background function. --- netlify/functions/storyblok-background.mts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/netlify/functions/storyblok-background.mts b/netlify/functions/storyblok-background.mts index 05142c03..8c067f2f 100644 --- a/netlify/functions/storyblok-background.mts +++ b/netlify/functions/storyblok-background.mts @@ -105,13 +105,8 @@ const pingSlack = async (message: string) => { */ const fetchStory = async (storyID: string) => { console.log('Fetching story:', storyID); - const context = process.env.CONTEXT; - let sbToken; - if (context === 'production') { - sbToken = process.env.PRODUCTION_STORYBLOK_ACCESS_TOKEN || process.env.STORYBLOK_ACCESS_TOKEN; - } else { - sbToken = process.env.STORYBLOK_ACCESS_TOKEN; - } + const sbToken = process.env.STORYBLOK_PREVIEW_EDITOR_TOKEN; + const sbConfig = { accessToken: sbToken, region: 'us'