Vercel NESTJS deploy

I tried many ways of deploy nest here on vercel i got a mono repo that uses nestjs and wants to deploy it but when use framework recomendation due to tsnode that doesn’t recognize the tsconfig path option it throws an error of unreconize modules and then tried build by my own with bun and create a js build and run the file that it generates but it doesn’t work.

then use vercel.jso no results, tried rewriting the request to redirect to the main.js and it serves the file as static heres the files

// package json
{
    "name": "api",
    "version": "0.0.1",
    "description": "",
    "author": "",
    "private": true,
    "license": "UNLICENSED",
    "scripts": {
        "build": "bun run build.ts",
        "vercel-build": "bun install && bun run build",
        "start": "bun src/main.ts",
        "dev": "bun run --watch src/main.ts",
        "dev:debug": "bun --inspect --watch src/main.ts ",
        "start:debug": "bun --inspect src/main.ts ",
        "start:prod": "node --env-file=.env dist/main.js",
        "clean": "git clean -xdf .cache .turbo node_modules dist",
        "typecheck": "tsc --noEmit",
        "lint": "biome check --write --unsafe ."
    },
    "dependencies": {
        "@asteasolutions/zod-to-openapi": "^8.1.0",
        "@nestjs/common": "catalog:nest",
        "@nestjs/core": "catalog:nest",
        "@nestjs/microservices": "catalog:nest",
        "@nestjs/platform-express": "catalog:nest",
        "@nestjs/swagger": "^11.2.1",
        "@repo/common": "workspace:\*",
        "@repo/server": "workspace:\*",
        "@scalar/nestjs-api-reference": "^1.0.5",
        "path-to-regexp": "8.2.0",
        "reflect-metadata": "catalog:nest",
        "rxjs": "catalog:nest",
        "zod": "catalog:"
    },
    "devDependencies": {
        "@app/ts-config": "workspace:\*",
        "@nestjs/cli": "catalog:nest",
        "@nestjs/schematics": "catalog:nest",
        "@types/bun": "catalog:",
        "@nestjs/testing": "catalog:nest",
        "@types/express": "catalog:nest",
        "@types/node": "^22.10.7",
        "@types/supertest": "^6.0.2",
        "globals": "^16.0.0",
        "source-map-support": "^0.5.21",
        "ts-loader": "^9.5.2",
        "ts-node": "^10.9.2",
        "tsconfig-paths": "^4.2.0",
        "typescript": "catalog:"
    }
}
// build.ts
Bun.build({
    entrypoints: \['./src/main.ts'\],
    outdir: './dist',
    format: 'cjs',
    minify: true,
    target: 'node',
    external: \[
        '@nestjs/microservices',
        '@nestjs/websockets',
        'cache-manager',
        'class-transformer',
        'class-validator',
        'reflect-metadata',
        'rxjs',
        '@nestjs/common',
    \],
    tsconfig: './tsconfig.json',
}).catch((error) => {
    console.error('Build failed:', error)
    process.exit(1)
})
// vercel json
{
    "$schema": "[https://openapi.vercel.sh/vercel.json](https://openapi.vercel.sh/vercel.json)",
    "version": 2,
    "buildCommand": "bun run build",
    "framework": null,
    "outputDirectory": "dist"
}

this is my config I even try the cuntion but gw it throws me an error that the function fail

If you’re having trouble deploying an Express app, this guide can help.

You can also ask v0 for suggestions tailored to your own project setup.

We’ve just launched zero config Nest.js support so this should work out of the box, however your framework: null in your vercel.json is overriding it and stopping Vercel from checking to see if it’s Nest. If you remove that field then you should be able to deploy

A post was split to a new topic: Cannot access project files