Skip to content

vercel build TS errors (hono/turborepo/drizzle) #13892

@nktnet1

Description

@nktnet1

Summary

Running vercel build results in unexpected TypeScript errors.

This is not reproducible with tsc/tsup/etc.

Also, it appears that vercel build runs my server build command in package.json, which performs tsup successfully, but then does something on top that results in the error.

Expected vs Current

Expected: the project compiles without error

Current:

Error: src/index.ts:77:37 - error TS2339: Property 'body' does not exist on type 'Response'.

77       return c.newResponse(response.body, response);

There are also a few other type issues(e.g. coming from drizzle-orm), summarised with the diff below (indicated by as any has a hack to temporarily bypass errors):

diff --git a/apps/server/src/index.ts b/apps/server/src/index.ts
index 725fd4c..afd9d37 100644
--- a/apps/server/src/index.ts
+++ b/apps/server/src/index.ts
@@ -74,7 +74,7 @@ app.use(
   async (c, next) => {
     const { matched, response } = await api.handler(c.req.raw);
     if (matched) {
-      return c.newResponse(response.body, response);
+      return c.newResponse((response as any).body, response);
     }
 
     await next();
diff --git a/packages/api/src/server/index.ts b/packages/api/src/server/index.ts
index 51c42b7..c65bf3d 100644
--- a/packages/api/src/server/index.ts
+++ b/packages/api/src/server/index.ts
@@ -68,7 +68,7 @@ export const createApi = ({
         context: await createORPCContext({
           db,
           auth,
-          headers: request.headers,
+          headers: (request as any).headers,
         }),
       });
     },
diff --git a/packages/db/src/schemas/posts.ts b/packages/db/src/schemas/posts.ts
index 139baa6..cb9e3f4 100644
--- a/packages/db/src/schemas/posts.ts
+++ b/packages/db/src/schemas/posts.ts
@@ -5,8 +5,8 @@ import { user } from './auth';
 
 export const post = pgTable('post', (t) => ({
   id: t.uuid().primaryKey().defaultRandom(),
-  title: t.varchar({ length: 256 }).notNull(),
-  content: t.text().notNull(),
+  title: t.varchar({ length: 256 }).notNull() as any,
+  content: t.text().notNull() as any,
   createdAt: t
     .timestamp({ mode: 'string', withTimezone: true })
     .notNull()
@@ -22,5 +22,5 @@ export const CreatePostSchema = v.omit(
     title: v.pipe(v.string(), v.minLength(3), v.maxLength(256)),
     content: v.pipe(v.string(), v.minLength(5), v.maxLength(512)),
   }),
-  ['id', 'createdAt', 'createdBy'],
+  ['id', 'createdAt', 'createdBy'] as any,
 );

Reproduction

  1. Fork the rt-stack project from GitHub and connect it to Vercel

  2. Run pnpm install and vercel build

  3. Observe the output:

    Image

Other Information

Vercel settings:

  "settings": {
    "createdAt": 1757251260212,
    "framework": "hono",
    "devCommand": null,
    "installCommand": null,
    "buildCommand": null,
    "outputDirectory": null,
    "rootDirectory": "apps/server",
    "directoryListing": false,
    "nodeVersion": "22.x"
  }

The default build command (from vercel preview) appears to be:

Image
cd ../.. && turbo run build --filter={/apps/server}...

Although I've also tried changing it to

pnpm build --filter=server

Or even pnpm build, but the result is the same.

I've also tried things like adding

export const config = {
  runtime: 'nodejs',
};

although it doesn't change anything.


Issue reported by another user (NOTE: no new information, just for reference):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions