unable to host slack bot on vercel

232 views Asked by At

I've created a slack bot that I want to deploy with vercel and I keep getting the error: Error: Command "npm run build" exited with 1

when running vercel deploy.

In my package.json file I have: "build": "next build"

which is obviously incorrect as it throws this error. The vercel docs suggest (https://vercel.com/docs/errors#error-list/missing-build-script) "scripts": { "build": "[my-framework] build --output public"

so my question is, what is actually expected in here in order to make this work?

I would really appreciate some help getting the project up and running so I can use it on slack. It works locally just fine, but can't get it up and running without me starting it locally. Here is the repo: https://github.com/Chaffexd/weds-slack-bot

1

There are 1 answers

0
MattieTK On

The correct build script for a nextjs app is next build.

Your script currently has npm run-script build.

Which is actually the equivalent of telling it to run itself over and over, it's self referencing.

Also, as an aside, your app is not going to work on Vercel. Vercel is a serverless environment, meaning long running applications like the one you have written that is continually listening on a port (I imagine when you run it locally it hangs for input) are not supported. You should refactor your app to respond to requests, which can trigger your function.

A good way of building this app on Vercel with NextJS might be to use the NextJS API folder for your application code, and then find a free CRON runner to repeatedly hit that function endpoint every day.