Summary
Vercel build issue after tsup completes successfully.
Cannot reproduce with typescript/webpack/tsup/other bundlers - only vercel build.
Expected vs Current
Expected: vercel builds project without any type errors
Current: vercel builds with error:
Error: src/index.ts:77:37 - error TS2339: Property 'body' does not exist on type 'Response'.
77 return c.newResponse(response.body, response);
In addition to response.body, there are also issues with request.headers and a few others from drizzle-orm. Summary of how to bypass the TS 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
-
Fork the rt-stack project from GitHub and connect it to Vercel
-
Try to deploy “apps/server” (the hono backend server)
-
Observe the output:
The same issue occurs with vercel build locally.
Other details
| Info | Description |
|---|---|
| Source Code | https://github.com/nktnet1/rt-stack |
| Framework | Turborepo, Hono, oRPC |
| Project Settings |
Everything was left as default, but I've also tried overriding the build command, etc. Issue is, my build command runs to completion, but `vercel build` seems to run something on top afterwards.
|
Issue reported by another user (NOTE: no new information, just for reference):

