I keep encountering a Code: NOT_FOUND
error on my server while running the endpoint.
The issue seems to be related to the configuration setup of my TypeScript-based Node server, and I've been struggling with it for quite some time now.
Additionally, the deployment summary never seems to finish running:👇https://i.sstatic.net/v10wG.png
Below is the file structure of my server directory:
Server
├─ .env
├─ dist
│ ├─ index.js
│ └─ model
│ └─ topic.js
├─ index.ts
├─ model
│ └─ topic.ts
├─ package-lock.json
├─ package.json
├─ tsconfig.json
└─ vercel.json
vercel.json
{
"builds": [
{
"src": "dist/index.js",
"use": "@vercel/node",
"config": { "includeFiles": ["dist/**"] }
}
],
"routes": [
{
"src": "/(.*)",
"dest": "dist/index.js"
}
]
}
The configurations in my package.json
that I only partially understood from various blog posts are as follows:
"scripts": {
"start": "node ./dist/index.js",
"build": "npx tsc",
"ts.check": "tsc --project tsconfig.json",
"add-build": "git add dist",
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "concurrently \"npx tsc --watch\" \"nodemon dist/index.js\""
},
"pre-commit": [
"ts.check",
"build",
"add-build"
],
Error: https://i.sstatic.net/InzJD.png
Everything works perfectly fine when using the server locally. However, I am unsure about how to resolve the TypeScript server deployment, as it is quite different from deploying a normal Node.js Express server.