File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed
supabase/functions/email-campaigns Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -169,8 +169,27 @@ export function getSenderCredentialIssue(
169169 return null ;
170170 }
171171
172- const expiresAt = Number ( source . credentials . expiresAt ) ;
173- if ( Number . isFinite ( expiresAt ) && expiresAt > 0 && expiresAt <= nowMs ) {
172+ let expiresAt = source . credentials . expiresAt ;
173+
174+ // Handle both numeric timestamp and ISO date string
175+ if ( typeof expiresAt === "string" ) {
176+ expiresAt = new Date ( expiresAt ) . getTime ( ) ;
177+ }
178+
179+ const numericExpiresAt = Number ( expiresAt ) ;
180+ if (
181+ Number . isFinite ( numericExpiresAt ) &&
182+ numericExpiresAt > 0 &&
183+ numericExpiresAt <= nowMs
184+ ) {
185+ console . log (
186+ "[OAuth] Token IS EXPIRED for:" ,
187+ source . email ,
188+ "- expiresAt:" ,
189+ numericExpiresAt ,
190+ "- now:" ,
191+ nowMs ,
192+ ) ;
174193 return "OAuth token expired. Please reconnect this account in sources." ;
175194 }
176195
You can’t perform that action at this time.
0 commit comments