Skip to content

feat(marketing): load env from monorepo root and add cookie domain default#349

Merged
Kitenite merged 5 commits into
mainfrom
feat/marketing-env-config
Dec 13, 2025
Merged

feat(marketing): load env from monorepo root and add cookie domain default#349
Kitenite merged 5 commits into
mainfrom
feat/marketing-env-config

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Dec 13, 2025

Changes

  • Add dotenv package to load .env from monorepo root in development mode
  • Set NEXT_PUBLIC_COOKIE_DOMAIN default to 'localhost' for local development
  • Load root .env file with override flag to ensure proper environment variable loading

Why

This ensures the marketing app can properly load environment variables from the monorepo root .env file during development, matching the pattern used in other apps in the monorepo.

Summary by CodeRabbit

  • Chores

    • Added dotenv as a dev dependency and improved dev environment loading.
    • Added a default cookie-domain value to simplify local development.
  • Style

    • Refined responsive spacing, padding and typography across header, CTA, download button, platform dropdown and social links for improved small-screen layout.
    • Shortened some button/link labels on small viewports and adjusted dropdown sizing/positioning for better alignment.
  • Bug Fixes

    • Hidden sign-in link by default in the not-logged-in state.

✏️ Tip: You can customize this high-level summary in your review settings.

…fault

- Add dotenv package to load .env from monorepo root in development
- Set NEXT_PUBLIC_COOKIE_DOMAIN default to 'localhost' for local development
- Load root .env file with override flag to ensure proper environment variable loading
@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 13, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
marketing Error Error Dec 13, 2025 2:30am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 13, 2025

Walkthrough

Loads development env from the monorepo root via dotenv in development and makes NEXT_PUBLIC_COOKIE_DOMAIN optional with default "localhost". Multiple marketing UI components receive responsive spacing, padding, and label adjustments.

Changes

Cohort / File(s) Summary
Development environment & schema
apps/marketing/package.json, apps/marketing/src/env.ts
Added dotenv as a devDependency; in development, env.ts loads the monorepo root .env (override) and NEXT_PUBLIC_COOKIE_DOMAIN changed from required z.string() to z.string().default("localhost").
CTA / action buttons
apps/marketing/src/app/components/CTAButtons/CTAButtons.tsx, apps/marketing/src/app/components/DownloadButton/DownloadButton.tsx
Adjusted responsive gaps/padding and icon spacing; button labels split into responsive spans (e.g., "Dashboard" → "Dash" on very small screens, "Download for macOS" → "Download" on small viewports).
Header & layout
apps/marketing/src/app/components/Header/Header.tsx
Updated header paddings to responsive values, added stepped logo heights (base → sm → md), and refined CTA area gaps across breakpoints.
Platform dropdown
apps/marketing/src/app/components/PlatformDropdown/PlatformDropdown.tsx
Dropdown width changed to responsive w-[calc(100vw-2rem)] with sm:w-80; added sideOffset={8} and alignOffset={-8} for positioning.
Social links
apps/marketing/src/app/components/SocialLinks/SocialLinks.tsx
Reduced small-viewport anchor padding (p-2p-1 sm:p-2) for social icon links.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review focal points:
    • apps/marketing/src/env.ts — verify dotenv path, override behavior, and that default for NEXT_PUBLIC_COOKIE_DOMAIN is appropriate for dev only.
    • Visual checks for CTAButtons.tsx, DownloadButton.tsx, and Header.tsx for responsive behavior and accessibility (label truncation, icon alignment).
    • PlatformDropdown.tsx positioning and viewport-clamping behavior.

Possibly related PRs

Poem

🐰 A small dotenv hop into the root,
I nudge cookies to "localhost" to boot,
Buttons tuck, logos stretch, and dropdowns slide,
I nibble gaps so layouts fit with pride,
🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive The PR description covers the key changes and rationale, but deviates from the repository's template structure with sections not matching the defined template format. Consider restructuring the description to follow the repository template, including sections like 'Related Issues', 'Type of Change', 'Testing', and 'Additional Notes' for consistency with repository standards.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately summarizes the main changes: adding dotenv for environment loading from monorepo root and setting a default cookie domain.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/marketing-env-config

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

- Reduce header padding on mobile (px-4 on mobile, scaling up)
- Make logo smaller on mobile (h-8 on mobile)
- Reduce spacing between elements on mobile
- Shorten button text on mobile (Download instead of Download for macOS)
- Make PlatformDropdown responsive width on mobile
- Reduce social links padding on mobile
- Hide Sign In button
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 13, 2025

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

Service Status
Neon Database (Neon)

Thank you for your contribution! 🎉


Preview resources have been processed for cleanup

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3de53d0 and 7d7c505.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • apps/marketing/package.json (1 hunks)
  • apps/marketing/src/env.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,js,jsx,json}

📄 CodeRabbit inference engine (AGENTS.md)

Use Biome for code formatting and linting, running at root level for speed

Files:

  • apps/marketing/package.json
  • apps/marketing/src/env.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Avoid any type and prioritize type safety in TypeScript code

Files:

  • apps/marketing/src/env.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-12T05:45:09.673Z
Learning: Applies to apps/desktop/src/main/index.ts : Load environment variables in apps/desktop/src/main/index.ts with override: true before any imports
📚 Learning: 2025-12-12T05:45:09.672Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-12T05:45:09.672Z
Learning: Applies to packages/ui/**/*.{ts,tsx} : Use React + TailwindCSS v4 + shadcn/ui for UI components in `packages/ui`

Applied to files:

  • apps/marketing/package.json
📚 Learning: 2025-12-12T05:45:09.673Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-12T05:45:09.673Z
Learning: Applies to apps/desktop/src/main/index.ts : Load environment variables in apps/desktop/src/main/index.ts with override: true before any imports

Applied to files:

  • apps/marketing/src/env.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Deploy Marketing
  • GitHub Check: Deploy Admin
  • GitHub Check: Deploy Web
  • GitHub Check: Deploy Docs
  • GitHub Check: Deploy API
  • GitHub Check: Build
🔇 Additional comments (3)
apps/marketing/src/env.ts (2)

3-4: LGTM!

The imports are appropriate for the dotenv loading functionality.


26-26: LGTM! Sensible default for local development.

The "localhost" default improves developer experience by eliminating the need to configure cookie domain for local development. Ensure production deployments still explicitly set NEXT_PUBLIC_COOKIE_DOMAIN to the appropriate domain.

apps/marketing/package.json (1)

41-41: Dotenv version is valid and secure.

Version 17.2.3 exists on the npm registry with no known security vulnerabilities reported.

Comment thread apps/marketing/src/env.ts
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
apps/marketing/src/env.ts (1)

7-10: Use __dirname instead of process.cwd() for reliable path resolution.

The dotenv path should resolve relative to this file's location, not the current working directory. Replace resolve(process.cwd(), "../../.env") with resolve(__dirname, "../../.env") to ensure the monorepo root .env is loaded consistently regardless of how the dev server is started.

Based on learnings, this matches the pattern from the desktop app where environment variables should be loaded with reliable path resolution.

Apply this diff:

-	config({ path: resolve(process.cwd(), "../../.env"), override: true });
+	config({ path: resolve(__dirname, "../../.env"), override: true });
🧹 Nitpick comments (1)
apps/marketing/src/app/components/CTAButtons/CTAButtons.tsx (1)

17-18: Consider a clearer abbreviation than "Dash".

The abbreviation "Dash" for "Dashboard" may not be immediately clear to users on small viewports. Consider alternatives like "App" or keeping the full word if space permits.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7d7c505 and bfd13be.

📒 Files selected for processing (6)
  • apps/marketing/src/app/components/CTAButtons/CTAButtons.tsx (1 hunks)
  • apps/marketing/src/app/components/DownloadButton/DownloadButton.tsx (2 hunks)
  • apps/marketing/src/app/components/Header/Header.tsx (2 hunks)
  • apps/marketing/src/app/components/PlatformDropdown/PlatformDropdown.tsx (1 hunks)
  • apps/marketing/src/app/components/SocialLinks/SocialLinks.tsx (2 hunks)
  • apps/marketing/src/env.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx,json}

📄 CodeRabbit inference engine (AGENTS.md)

Use Biome for code formatting and linting, running at root level for speed

Files:

  • apps/marketing/src/app/components/PlatformDropdown/PlatformDropdown.tsx
  • apps/marketing/src/app/components/Header/Header.tsx
  • apps/marketing/src/app/components/DownloadButton/DownloadButton.tsx
  • apps/marketing/src/env.ts
  • apps/marketing/src/app/components/SocialLinks/SocialLinks.tsx
  • apps/marketing/src/app/components/CTAButtons/CTAButtons.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Avoid any type and prioritize type safety in TypeScript code

Files:

  • apps/marketing/src/app/components/PlatformDropdown/PlatformDropdown.tsx
  • apps/marketing/src/app/components/Header/Header.tsx
  • apps/marketing/src/app/components/DownloadButton/DownloadButton.tsx
  • apps/marketing/src/env.ts
  • apps/marketing/src/app/components/SocialLinks/SocialLinks.tsx
  • apps/marketing/src/app/components/CTAButtons/CTAButtons.tsx
**/components/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/components/**/*.{ts,tsx}: Structure project folders as one folder per component with PascalCase naming (ComponentName/ComponentName.tsx + index.ts barrel export)
Co-locate component dependencies (utils, hooks, constants, config, tests, stories) next to the file using them
Use one component per file (no multi-component files)

Files:

  • apps/marketing/src/app/components/PlatformDropdown/PlatformDropdown.tsx
  • apps/marketing/src/app/components/Header/Header.tsx
  • apps/marketing/src/app/components/DownloadButton/DownloadButton.tsx
  • apps/marketing/src/app/components/SocialLinks/SocialLinks.tsx
  • apps/marketing/src/app/components/CTAButtons/CTAButtons.tsx
🧠 Learnings (3)
📚 Learning: 2025-12-12T05:45:09.673Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-12T05:45:09.673Z
Learning: Applies to **/components/{ui,ai-elements,react-flow}/**/*.{ts,tsx} : For shadcn/ui components, use kebab-case single files (e.g., button.tsx) in src/components/ui/, src/components/ai-elements, and src/components/react-flow/ directories

Applied to files:

  • apps/marketing/src/app/components/DownloadButton/DownloadButton.tsx
  • apps/marketing/src/app/components/CTAButtons/CTAButtons.tsx
📚 Learning: 2025-12-12T05:45:09.673Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-12T05:45:09.673Z
Learning: Applies to apps/desktop/src/main/index.ts : Load environment variables in apps/desktop/src/main/index.ts with override: true before any imports

Applied to files:

  • apps/marketing/src/env.ts
📚 Learning: 2025-11-24T21:33:13.267Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: apps/desktop/AGENTS.md:0-0
Timestamp: 2025-11-24T21:33:13.267Z
Learning: Applies to apps/desktop/**/*.{ts,tsx} : Please use alias as defined in `tsconfig.json` when possible

Applied to files:

  • apps/marketing/src/env.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Deploy Web
  • GitHub Check: Deploy API
  • GitHub Check: Deploy Marketing
  • GitHub Check: Deploy Admin
  • GitHub Check: Deploy Docs
  • GitHub Check: Build
🔇 Additional comments (8)
apps/marketing/src/app/components/SocialLinks/SocialLinks.tsx (1)

14-14: LGTM! Responsive padding refinement.

The updated padding classes provide tighter spacing on small viewports while maintaining comfortable touch targets on larger screens, consistent with the responsive UI improvements across this PR.

Also applies to: 32-32

apps/marketing/src/app/components/PlatformDropdown/PlatformDropdown.tsx (1)

43-45: LGTM! Responsive dropdown positioning and sizing.

The offset props fine-tune alignment with the trigger, and the responsive width ensures the dropdown adapts gracefully across viewport sizes. The calc(100vw-2rem) correctly accounts for horizontal margins on mobile while reverting to a fixed width on larger screens.

apps/marketing/src/app/components/DownloadButton/DownloadButton.tsx (2)

19-21: LGTM! Responsive size classes.

The updated padding and text sizing provide tighter spacing on mobile while maintaining comfortable proportions on larger screens, consistent with the responsive design improvements throughout this PR.


96-97: LGTM! Responsive label rendering.

The split-span approach adapts the button label for smaller viewports while preserving clarity on larger screens. This matches the pattern used in CTAButtons.tsx.

apps/marketing/src/env.ts (1)

26-26: LGTM! Appropriate default for local development.

The default value of "localhost" for NEXT_PUBLIC_COOKIE_DOMAIN correctly supports local development without requiring explicit configuration, aligning with the PR's objective to simplify the development setup.

apps/marketing/src/app/components/CTAButtons/CTAButtons.tsx (2)

12-12: LGTM! Responsive spacing refinements.

The tighter gaps and padding on smaller viewports improve the mobile experience while maintaining comfortable spacing on larger screens, consistent with the responsive design improvements across this PR.

Also applies to: 15-15, 22-22, 33-33, 42-42


24-25: LGTM! Responsive label rendering for download action.

The split-span approach provides a concise label on mobile while maintaining clarity on desktop, matching the pattern in DownloadButton.tsx.

Also applies to: 44-45

apps/marketing/src/app/components/Header/Header.tsx (1)

15-15: LGTM! Comprehensive responsive header refinements.

The stepped responsive scaling for padding, logo size, and gaps provides excellent adaptation across viewport sizes. The additional md breakpoint offers finer control over the transition from mobile to desktop layouts, consistent with the responsive design improvements throughout this PR.

Also applies to: 30-30, 36-36

Comment thread apps/marketing/src/app/components/CTAButtons/CTAButtons.tsx
Comment thread apps/marketing/src/env.ts

if (process.env.NODE_ENV === "development") {
// Load .env from monorepo root
config({ path: resolve(__dirname, "../../.env"), override: true });
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saddlepaddle fyi I just have this load .env from root. I think it's annoying to have more than 1 especially as an open-source monorepo

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tru we can do that too! i have direnv set up fyi, but this is reasonable too to add to each project 👍🏼

<a
href={`${env.NEXT_PUBLIC_WEB_URL}/sign-in`}
className="px-4 py-2 text-sm font-normal text-muted-foreground hover:text-foreground transition-colors"
className="hidden px-2 sm:px-4 py-2 text-sm font-normal text-muted-foreground hover:text-foreground transition-colors"
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saddlepaddle fyi hiding this because it is not functional and can cause confusion

@Kitenite Kitenite merged commit 4d15e65 into main Dec 13, 2025
12 of 14 checks passed
@Kitenite Kitenite deleted the feat/marketing-env-config branch December 13, 2025 02:34
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/marketing/src/env.ts (1)

29-38: Avoid defaulting NEXT_PUBLIC_COOKIE_DOMAIN to localhost in production.
As written, a missing prod value will silently become "localhost", which is very likely wrong and hard to notice.

A safer pattern is: keep the client schema optional, and only default to "localhost" in development when wiring experimental__runtimeEnv:

 client: {
   NEXT_PUBLIC_API_URL: z.string().url(),
   NEXT_PUBLIC_WEB_URL: z.string().url(),
   NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: z.string(),
-  NEXT_PUBLIC_COOKIE_DOMAIN: z.string().default("localhost"),
+  NEXT_PUBLIC_COOKIE_DOMAIN: z.string().optional(),
 },
 experimental__runtimeEnv: {
   NODE_ENV: process.env.NODE_ENV,
   NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL,
   NEXT_PUBLIC_WEB_URL: process.env.NEXT_PUBLIC_WEB_URL,
   NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY:
     process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY,
-  NEXT_PUBLIC_COOKIE_DOMAIN: process.env.NEXT_PUBLIC_COOKIE_DOMAIN,
+  NEXT_PUBLIC_COOKIE_DOMAIN:
+    process.env.NEXT_PUBLIC_COOKIE_DOMAIN ??
+    (process.env.NODE_ENV === "development" ? "localhost" : undefined),
 },
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bfd13be and 92050b6.

📒 Files selected for processing (1)
  • apps/marketing/src/env.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,js,jsx,json}

📄 CodeRabbit inference engine (AGENTS.md)

Use Biome for code formatting and linting, running at root level for speed

Files:

  • apps/marketing/src/env.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Avoid any type and prioritize type safety in TypeScript code

Files:

  • apps/marketing/src/env.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-12T05:45:09.672Z
Learning: Applies to **/components/**/*.{ts,tsx} : Co-locate component dependencies (utils, hooks, constants, config, tests, stories) next to the file using them
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-12T05:45:09.673Z
Learning: Applies to apps/desktop/src/main/index.ts : Load environment variables in apps/desktop/src/main/index.ts with override: true before any imports
📚 Learning: 2025-12-12T05:45:09.673Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-12T05:45:09.673Z
Learning: Applies to apps/desktop/src/main/index.ts : Load environment variables in apps/desktop/src/main/index.ts with override: true before any imports

Applied to files:

  • apps/marketing/src/env.ts
📚 Learning: 2025-11-24T21:33:13.267Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: apps/desktop/AGENTS.md:0-0
Timestamp: 2025-11-24T21:33:13.267Z
Learning: Applies to apps/desktop/**/*.{ts,tsx} : Please use alias as defined in `tsconfig.json` when possible

Applied to files:

  • apps/marketing/src/env.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Deploy Marketing
  • GitHub Check: Deploy Web
  • GitHub Check: Deploy Docs
  • GitHub Check: Deploy Admin
  • GitHub Check: Deploy API
  • GitHub Check: Build

Comment thread apps/marketing/src/env.ts
Comment on lines +1 to +13
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { createEnv } from "@t3-oss/env-nextjs";
import { vercel } from "@t3-oss/env-nextjs/presets-zod";
import { config } from "dotenv";
import { z } from "zod";

const __dirname = dirname(fileURLToPath(import.meta.url));

if (process.env.NODE_ENV === "development") {
// Load .env from monorepo root
config({ path: resolve(__dirname, "../../.env"), override: true });
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# 1. Find the monorepo structure and .env file locations
find . -maxdepth 3 -name ".env*" -type f 2>/dev/null | head -20

Repository: superset-sh/superset

Length of output: 78


🏁 Script executed:

# 2. Check the directory structure to confirm path resolution
ls -la apps/marketing/src/ 2>/dev/null | head -20
ls -la apps/ 2>/dev/null

Repository: superset-sh/superset

Length of output: 836


🏁 Script executed:

# 3. Search for imports of env.ts in the apps/marketing directory
rg -n 'from\s+["\x27].*env(\.ts)?["\x27]|import.*env' apps/marketing --type ts --type tsx -A 2

Repository: superset-sh/superset

Length of output: 91


🏁 Script executed:

# 4. Check if any files importing env.ts have "use client" directive
rg -l 'use client' apps/marketing --type ts --type tsx | xargs -I {} bash -c 'echo "=== {} ==="; rg "from.*env|import.*env" {} --type ts --type tsx'

Repository: superset-sh/superset

Length of output: 91


🏁 Script executed:

# 5. Verify the actual .env path by checking if files exist
realpath apps/marketing/src/env.ts 2>/dev/null && echo "---" && ls -la ../.env 2>/dev/null; ls -la ../../.env 2>/dev/null; ls -la ../../../.env 2>/dev/null

Repository: superset-sh/superset

Length of output: 46


🏁 Script executed:

# Search for imports of env.ts with proper syntax
rg -n 'from.*["\x27].*env(\.ts)?["\x27]|import.*\{.*env' apps/marketing -A 2 -B 1

Repository: superset-sh/superset

Length of output: 989


🏁 Script executed:

# Look for "use client" directives and subsequent imports
rg -l 'use client' apps/marketing | head -10

Repository: superset-sh/superset

Length of output: 639


🏁 Script executed:

# Check the actual .env loading context - is this in a server-only file?
cat apps/marketing/src/env.ts

Repository: superset-sh/superset

Length of output: 1329


🏁 Script executed:

# Find all TypeScript files in apps/marketing that import env
find apps/marketing -name "*.ts" -o -name "*.js" | xargs grep -l "from.*env" 2>/dev/null

Repository: superset-sh/superset

Length of output: 89


🏁 Script executed:

# Check if layout.tsx is a server component or has use client
head -20 apps/marketing/src/app/layout.tsx

Repository: superset-sh/superset

Length of output: 679


🏁 Script executed:

# Check CTAButtons to see if it's server or client
head -15 apps/marketing/src/app/components/CTAButtons/CTAButtons.tsx

Repository: superset-sh/superset

Length of output: 561


🏁 Script executed:

# Verify path resolution more precisely
python3 << 'EOF'
import os
from pathlib import Path

# Simulate the __dirname value
file_path = Path("apps/marketing/src/env.ts").resolve()
dirname_value = file_path.parent  # apps/marketing/src

# Current resolution: ../../.env
resolved_current = (dirname_value / "../../.env").resolve()
print(f"Current path (../../.env): {resolved_current}")

# Proposed resolution: ../../../.env
resolved_proposed = (dirname_value / "../../../.env").resolve()
print(f"Proposed path (../../../.env): {resolved_proposed}")

# Show what's actually present
repo_root = Path(".").resolve()
print(f"\nRepo root: {repo_root}")
print(f"Files at repo root: {[f.name for f in repo_root.glob('.env*')]}")
EOF

Repository: superset-sh/superset

Length of output: 150


🏁 Script executed:

# Check what files exist in apps directory
find apps -maxdepth 1 -type f -name ".env*" 2>/dev/null

Repository: superset-sh/superset

Length of output: 46


🏁 Script executed:

# Verify the monorepo .env location more carefully
find . -maxdepth 2 -name ".env" -type f 2>/dev/null
ls -la .env* 2>/dev/null || echo "No .env files at repo root"

Repository: superset-sh/superset

Length of output: 124


Fix incorrect .env path and remove unsafe cookie domain default.

The path resolve(__dirname, "../../.env") resolves to apps/.env, not the monorepo root. Use ../../../.env instead:

-	config({ path: resolve(__dirname, "../../.env"), override: true });
+	config({ path: resolve(__dirname, "../../../.env"), override: true });

Additionally, NEXT_PUBLIC_COOKIE_DOMAIN defaults to "localhost" in the client schema, causing silent misconfiguration in production if the variable is omitted. Either require it explicitly or make the default conditional to development.

🤖 Prompt for AI Agents
In apps/marketing/src/env.ts around lines 1-13, the dotenv path currently uses
resolve(__dirname, "../../.env") which points to apps/.env instead of the
monorepo root; change it to resolve(__dirname, "../../../.env") so it loads the
root .env. Also remove the unsafe client-side default for
NEXT_PUBLIC_COOKIE_DOMAIN (currently "localhost"): update the env schema to
either make NEXT_PUBLIC_COOKIE_DOMAIN required (no default) or supply a default
only when process.env.NODE_ENV === "development" so production cannot silently
run with the wrong domain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants