@@ -14,6 +14,7 @@ import nodemailer from 'nodemailer'
1414import { extname , join } from 'path'
1515import qs from 'qs'
1616import {
17+ BikeTagEnv ,
1718 getDomainInfo ,
1819 getImageSized ,
1920 getTagDateISOFromTimezone ,
@@ -498,7 +499,10 @@ export const getPayloadAuthorization = async (
498499 const { payload } = await jose . jwtVerify ( authStr , JWKS )
499500 return payload
500501 } catch ( e : any ) {
501- if ( e . code === 'ERR_JWT_EXPIRED' ) return null
502+ if ( e . code === 'ERR_JWT_EXPIRED' ) {
503+ log ( 'Auth0 JWT expired' , e , 'warn' )
504+ return null
505+ }
502506 log ( 'Auth0 JWT verification error' , e , 'warn' )
503507 return authStr
504508 }
@@ -857,9 +861,14 @@ export const archiveAndClearQueue = async (
857861 { game : queuedTags [ 0 ] . game } ,
858862 { source : 'sanity' } ,
859863 )
860- game = gameResponse . success ? gameResponse . data : undefined
864+ if ( gameResponse . success ) {
865+ game = gameResponse . data
866+ } else {
867+ return { results : [ { message : ErrorMessage . GameNotSet , game : undefined } ] , errors : true }
868+ }
861869 }
862- const imageSource = game ?. awsRegion ? 'aws' : 'imgur'
870+
871+ const imageSource = getImageSource ( game )
863872
864873 if ( queuedTags . length && game ) {
865874 const nonAdminBikeTagOpts = getBikeTagClientOpts ( undefined , true , false , game )
@@ -1939,5 +1948,5 @@ export const getImageSource = (game: Game): 'aws' | 'imgur' => {
19391948 } else if ( game . mainhash ?. length ) {
19401949 return 'imgur'
19411950 }
1942- return 'imgur'
1951+ return BikeTagEnv . IMAGE_SOURCE as 'aws' | 'imgur'
19431952}
0 commit comments