Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions app/providers/ConsolidatedProviders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,25 @@ export function NavigationProviders({ children }: { children: React.ReactNode })
*/
export function AllAppProviders({ children }: { children: React.ReactNode }) {
const pathname = usePathname();
const isRootOrAuthFlow = !pathname || pathname === '/' || pathname.startsWith('/auth');
const isWelcomeFlow = pathname?.startsWith('/welcome');

if (isRootOrAuthFlow) {
// During transitional renders where pathname is temporarily unavailable,
// use the full provider stack to avoid missing required contexts.
if (!pathname) {
return (
<UIProviders>
<FinancialProviders>
<NavigationProviders>
{children}
</NavigationProviders>
</FinancialProviders>
</UIProviders>
);
}

const isAuthFlow = pathname.startsWith('/auth');
const isWelcomeFlow = pathname.startsWith('/welcome');

if (isAuthFlow) {
return (
<UIProviders>
{children}
Expand Down
14 changes: 9 additions & 5 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,15 @@ const nextConfig = {
'jose',
],

// Explicitly include jose in serverless function traces
// This fixes the "Cannot find package 'jose'" error on Vercel when using bun lockfile
// bun creates a .bun folder symlink structure that Vercel's runtime can't resolve
// Explicitly include jose + jwks-rsa in serverless function traces.
// IMPORTANT: Bun installs `node_modules/<pkg>` as symlinks into `node_modules/.bun/...`.
// Including symlinked paths can produce invalid Vercel Serverless deployment packages.
// We therefore trace the real Bun store paths directly and avoid symlink globs.
outputFileTracingIncludes: {
'/api/**/*': ['./node_modules/jose/**/*', './node_modules/jwks-rsa/**/*'],
'/api/**/*': [
'./node_modules/.bun/jose@*/node_modules/jose/**/*',
'./node_modules/.bun/jwks-rsa@*/node_modules/jwks-rsa/**/*',
],
},

// Logging configuration
Expand Down Expand Up @@ -239,7 +243,7 @@ const nextConfig = {
"style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://connect-js.stripe.com https://*.stripe.com",
"font-src 'self' https://fonts.gstatic.com",
"img-src 'self' data: https: https://*.stripe.com https://*.tile.openstreetmap.org https://*.basemaps.cartocdn.com https://cdnjs.cloudflare.com",
"connect-src 'self' https://api.stripe.com https://connect-js.stripe.com https://*.stripe.com wss://*.stripe.com https://*.googleapis.com https://apis.google.com https://firebase.googleapis.com https://firestore.googleapis.com https://firestore.googleapis.com/google.firestore.v1.Firestore/Listen/channel https://firebaseinstallations.googleapis.com https://securetoken.googleapis.com https://identitytoolkit.googleapis.com wss://*.firebaseio.com https://*.firebaseio.com https://www.googletagmanager.com https://www.google-analytics.com https://analytics.google.com https://*.logrocket.io https://*.lr-ingest.io https://*.logrocket.com https://*.lr-in.com https://*.lr-in-prod.com https://*.lr-ingest.com https://*.ingest-lr.com https://cdn.lgrckt-in.com https://*.lgrckt-in.com https://va.vercel-scripts.com https://*.vercel-scripts.com wss://api.wewrite.app https://api.wewrite.app https://cdn.lordicon.com https://challenges.cloudflare.com",
"connect-src 'self' https://api.stripe.com https://connect-js.stripe.com https://*.stripe.com wss://*.stripe.com https://*.googleapis.com https://apis.google.com https://firebase.googleapis.com https://firestore.googleapis.com https://firestore.googleapis.com/google.firestore.v1.Firestore/Listen/channel https://firebaseinstallations.googleapis.com https://securetoken.googleapis.com https://identitytoolkit.googleapis.com wss://*.firebaseio.com https://*.firebaseio.com https://www.googletagmanager.com https://www.google-analytics.com https://analytics.google.com https://*.logrocket.io https://*.lr-ingest.io https://*.logrocket.com https://*.lr-in.com https://*.lr-in-prod.com https://*.lr-ingest.com https://*.ingest-lr.com https://cdn.lgrckt-in.com https://*.lgrckt-in.com https://*.logr-in.com https://va.vercel-scripts.com https://*.vercel-scripts.com wss://api.wewrite.app https://api.wewrite.app https://cdn.lordicon.com https://challenges.cloudflare.com",
"report-uri /api/csp-violations",
"frame-src 'self' https://js.stripe.com https://connect-js.stripe.com https://*.stripe.com https://*.firebaseapp.com https://wewrite-ccd82.firebaseapp.com https://challenges.cloudflare.com",
"worker-src 'self' blob:",
Expand Down