diff --git a/apps/web/src/app/(share)/share/[slug]/opengraph/route.tsx b/apps/web/src/app/(share)/share/[slug]/opengraph/route.tsx index 7cd7059f7..cb6738e3d 100644 --- a/apps/web/src/app/(share)/share/[slug]/opengraph/route.tsx +++ b/apps/web/src/app/(share)/share/[slug]/opengraph/route.tsx @@ -149,6 +149,10 @@ export async function GET(_request: Request, { params: { slug } }: SharePageOpen weight: 600, }, ], + headers: { + 'Access-Control-Allow-Origin': '*', + 'Access-Control-Allow-Methods': 'GET, OPTIONS', + }, }, ); } diff --git a/packages/ee/server-only/limits/handler.ts b/packages/ee/server-only/limits/handler.ts index f4b1bd4af..69f77db75 100644 --- a/packages/ee/server-only/limits/handler.ts +++ b/packages/ee/server-only/limits/handler.ts @@ -30,7 +30,7 @@ export const limitsHandler = async ( }); } - res.status(500).json({ + return res.status(500).json({ error: ERROR_CODES.UNKNOWN, }); } diff --git a/packages/lib/next-auth/auth-options.ts b/packages/lib/next-auth/auth-options.ts index ceaab9e7f..cd7692e52 100644 --- a/packages/lib/next-auth/auth-options.ts +++ b/packages/lib/next-auth/auth-options.ts @@ -91,8 +91,9 @@ export const NEXT_AUTH_OPTIONS: AuthOptions = { } if ( - !merged.lastSignedIn || - DateTime.fromISO(merged.lastSignedIn).plus({ hours: 1 }) <= DateTime.now() + merged.id && + (!merged.lastSignedIn || + DateTime.fromISO(merged.lastSignedIn).plus({ hours: 1 }) <= DateTime.now()) ) { merged.lastSignedIn = new Date().toISOString(); diff --git a/packages/lib/server-only/feature-flags/get.ts b/packages/lib/server-only/feature-flags/get.ts index 3157afb60..36aafc7b7 100644 --- a/packages/lib/server-only/feature-flags/get.ts +++ b/packages/lib/server-only/feature-flags/get.ts @@ -105,7 +105,7 @@ export const extractDistinctUserId = (jwt: JWT | null, request: NextRequest): st const config = extractPostHogConfig(); const email = jwt?.email; - const userId = jwt?.id.toString(); + const userId = jwt?.id?.toString(); let fallbackDistinctId = nanoid(); diff --git a/packages/ui/components/document/document-share-button.tsx b/packages/ui/components/document/document-share-button.tsx index 4ee7d319f..c243fd87a 100644 --- a/packages/ui/components/document/document-share-button.tsx +++ b/packages/ui/components/document/document-share-button.tsx @@ -88,7 +88,10 @@ export const DocumentShareButton = ({ } // Ensuring we've prewarmed the opengraph image for the Twitter - await fetch(`${process.env.NEXT_PUBLIC_WEBAPP_URL}/share/${slug}/opengraph`); + await fetch(`${process.env.NEXT_PUBLIC_WEBAPP_URL}/share/${slug}/opengraph`, { + // We don't care about the response, so we can use no-cors + mode: 'no-cors', + }); window.open( generateTwitterIntent(