Next.js Discord

Discord Forum

Issues with Vercel deployment with Serverless functions

Unanswered
Japanese pilchard posted this in #help-forum
Open in Discord
Avatar
Japanese pilchardOP
Hello.
Recently I have deployed my app to Vercel and wanted to apply serverles functions to hide, for instance, .env variables. For this case, the function its in my api/ directory, but for it to work, I had to add the lines "build" and "routes" to my vercel.json file, which now looks like this:
{ "version": 2, "builds": [{ "src": "api/**/*.cjs", "use": "@vercel/node" }], "routes": [{ "src": "/api/article", "dest": "/api/supabase-api.cjs" }] }
Now, as I have overridden the "builds" of Vercel, the dashboard ones which point to vite npm install and npm build are no longer working, how can I fix this? I believe i have to add those npm install and npm build to my vercel.json, but been researching for a while and found nothing

0 Replies