Summary
Hello, I'm trying to deploy a server of a particular package in monorepo using vercel. When I test it with vercel dev in my local environment, my api work fine. But after I deploy the production, when I go to the deployed link, I always see only the api/index.js source code. And Runtime Log doesn't show anything. Any tips for solving it?
Example
Deploy Link : https://all-about-dog-server.vercel.app/
Steps to Reproduce
I have configured the server code as below:
vercel.json
- I checked the Using Express.js with Verceldocument and configured vercel.json as below.
{ "version": 2, "rewrites": [{ "source": "/(.*)", "destination": "/api" }] }package.json
- I understand that Vercel's deployment path should be under the
/apidirectory. So I wrote avercel-buildscript to bundle the source code of theappdirectory and store it in theapidirectory. => Could there be a problem with this method?
{ "name": "@all-about-som/server", "version": "1.0.0", "description": "All about dog server", "main": "index.js", "scripts": { "start": "nodemon --exec ts-node -r tsconfig-paths/register app/index.ts", "test": "echo \"Error: no test specified\" && exit 1", "build": "tsup app --clean --format cjs,esm --env.NODE_ENV production", "vercel-build": "tsup app --clean --format cjs --env.NODE_ENV production --env.DEPLOYMENT_ENV vercel --out-dir api" },mongo db Setting
- I confirmed that the link between MongoDB Atlas and Vercel is also working well.
- IP Address set to 0.0.0.0/0
- MongoDB Atlas is linked to Vercel's Integrations
MONGODB_URIis set in Vercel's Environment Variables (id, pw match)
- Vercel Build & Development Settings
- Output Directory :
.
Fortunately, since it is a private project, I share the entire code as below:
Github : https://github.com/younyikim/younyikim-playground/tree/main/apps/all-about-som/server
Since there is no explanation in English on how to execute the project, I leave a separate guide here.
- You can go to Project Root, clone the repository, install dependency through
pnpm iand run it. - The project can be accessed directly from Root using the
pnpm all-about-some:servercommand.- ex)
pnpm all-about-som:server start,pnpm all-about-som:server vercel dev - Alternatively, you can access it by going directly to
cd apps/all-about-some/server.
- ex)
Any ideas?