Skip to content

fix(ci): resolve deployment error for auth-nextjs-demo on Vercel#66

Merged
halvaradop merged 9 commits intomasterfrom
fix/vercel-deploy
Jan 21, 2026
Merged

fix(ci): resolve deployment error for auth-nextjs-demo on Vercel#66
halvaradop merged 9 commits intomasterfrom
fix/vercel-deploy

Conversation

@halvaradop
Copy link
Copy Markdown
Member

@halvaradop halvaradop commented Jan 20, 2026

Description

This pull request fixes the error encountered when deploying the auth-nextjs-demo application on Vercel. The issue is recent and does not have a clear or well-documented root cause, which made it difficult to diagnose initially.

Several deployment attempts were made on Vercel with different local changes, but none of them resolved the problem. The build logs consistently indicated that the failure occurred during the build process of the @aura-stack/auth package.

After further investigation, the issue was traced to incorrect Zod schema inference during the TypeScript declaration (dts) build step. Specifically, some schemas were being typed as incompatible ZodObject instances, and search parameters were being accessed as strongly typed properties instead of through the URLSearchParams API.

Error Logs

@aura-stack/auth:build: src/actions/callback/callback.ts(17,13): error TS2740: Type 'ZodObject<{ oauth: ZodEnum<{ [x: string & Record<never, never>]: string & Record<never, never>; github: "github"; bitbucket: "bitbucket"; figma: "figma"; discord: "discord"; gitlab: "gitlab"; spotify: "spotify"; x: "x"; strava: "strava"; mailchimp: "mailchimp"; }>; }, $strip>' is missing the following properties from type 'ZodObject<any, UnknownKeysParam, ZodTypeAny, { [x: string]: any; }, { [x: string]: any; }>': _cached, _getCached, _parse, nonstrict, and 13 more.
@aura-stack/auth:build: src/actions/callback/callback.ts(20,13): error TS2740: Type 'ZodObject<{ state: ZodString; code: ZodString; }, $strip>' is missing the following properties from type 'ZodObject<any, UnknownKeysParam, ZodTypeAny, { [x: string]: any; }, { [x: string]: any; }>': _cached, _getCached, _parse, nonstrict, and 13 more.
@aura-stack/auth:build: src/actions/callback/callback.ts(43,33): error TS2339: Property 'code' does not exist on type 'URLSearchParams'.
@aura-stack/auth:build: src/actions/callback/callback.ts(43,39): error TS2339: Property 'state' does not exist on type 'URLSearchParams'.
@aura-stack/auth:build: Error: error occurred in dts build

Note

This pull request will be merged. However, it is possible that the current solution may introduce unexpected behavior. I will continue monitoring the codebase closely and watch for any side effects or regressions that may arise as a result of these changes.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Jan 20, 2026

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

Project Deployment Review Updated (UTC)
auth-nextjs-demo Ready Ready Preview, Comment Jan 21, 2026 8:19pm
1 Skipped Deployment
Project Deployment Review Updated (UTC)
auth Skipped Skipped Jan 21, 2026 8:19pm

- relocate shared lib and components directories
- remove generated routeTree.gen.ts artifact
- ignore routeTree.gen.ts in version control
@halvaradop
Copy link
Copy Markdown
Member Author

Root Cause Analysis and Resolution

After spending a significant amount of time investigating the root cause of the build error, the issue was finally identified.

The problem was primarily caused by a Zod version mismatch between the core package and the tanstack-start example application.

What Happened

  • The @aura-stack/auth core package was expected to use zod@^4.1.11.
  • However, for an unknown reason, the core package was resolving zod@^4.3.5, which was defined in the apps/tanstack-start package.
  • This mismatch caused TypeScript and Zod types to become incompatible during the dts build process, leading to confusing and misleading errors.

Initial Attempted Fix

To solve the issue, Zod was added to the pnpm catalogs with the expected version:

^4.1.11

However:

  • pnpm still resolved and installed zod@^4.3.5 instead of the catalog-defined version.
  • To force consistency, the version was pinned explicitly to 4.1.11.
  • This fixed the dependency resolution, but introduced a new issue:
    • The core package failed to build its type declarations.
    • The build crashed with a JavaScript heap out-of-memory / stack overflow error.

Final Solution

The stable and correct solution was:

  • Remove Zod from pnpm catalogs
  • Explicitly use the same Zod version (^4.1.11) in both:
    • packages/core
    • apps/tanstack-start

This approach aligns with the version already used by @aura-stack/router, ensuring consistency across the monorepo and avoiding subtle type incompatibilities.

Why ^4.1.11?
@aura-stack/router already depends on zod@^4.1.11. Using the same version prevents future mismatches and reduces maintenance overhead

Related Files

Core package Zod dependency

"zod": "^4.1.12"

TanStack Start example Zod dependency

"zod": "^4.3.5"

@halvaradop halvaradop merged commit cc84160 into master Jan 21, 2026
6 checks passed
@halvaradop halvaradop deleted the fix/vercel-deploy branch January 21, 2026 20:44
@halvaradop halvaradop added the fix Bug fixes that correct incorrect or unexpected behavior. label Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fixes that correct incorrect or unexpected behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant