chat-ui icon indicating copy to clipboard operation
chat-ui copied to clipboard

deploy in vercel

Open dominicdev opened this issue 2 years ago • 8 comments

I'm trying to deploy this in vercel, it was success but getting this page , any solution? I set the output to build, or this app is not possible to deploy in vercel? image

dominicdev avatar May 12 '23 13:05 dominicdev

Maybe you need to switch to adapter-vercel: https://kit.svelte.dev/docs/adapter-vercel ?

Currently we use adapter-node

coyotte508 avatar May 12 '23 13:05 coyotte508

This is correct. I've successfully deployed to Vercel with this adapter. I use adapter-node and deploying using Capitano, which is a tool I have been building and will be released soon and deploys apps to Docker Swarm. Also tested deployment via CapRover, successfully.

maietta avatar May 12 '23 15:05 maietta

Here is how I did (I hope it is useful):

import adapter from "@sveltejs/adapter-vercel";
import { vitePreprocess } from "@sveltejs/kit/vite";
import dotenv from "dotenv";
import pkg from "./package.json" assert { type: "json" };

dotenv.config({ path: "./.env.local" });
dotenv.config({ path: "./.env" });

process.env.PUBLIC_VERSION = pkg.version.replace(/\.0\b/g, "");

/** @type {import('@sveltejs/kit').Config} */
const config = {
	// Consult https://kit.svelte.dev/docs/integrations#preprocessors
	// for more information about preprocessors
	preprocess: vitePreprocess(),

	kit: {
		adapter: adapter({
			// see the 'Deployment configuration' section below
		}),

		paths: {
			base: process.env.APP_BASE || "",
		},
	},
};

export default config;

fredguth avatar May 12 '23 18:05 fredguth

thanks I will try this, also what will be the output? will be build folder?

dominicdev avatar May 13 '23 01:05 dominicdev

@fredguth im getting this what could be the problem? image

dominicdev avatar May 13 '23 01:05 dominicdev

have you created a mongodb cluster in atlas? you need a the mongo uri in .env.local

fredguth avatar May 17 '23 16:05 fredguth

Another point... you have to add your environment variables to the project in Vercel's dashboard (I guess there is a way via CLI).

fredguth avatar May 24 '23 03:05 fredguth

I think this issue can be closed.

fredguth avatar May 24 '23 12:05 fredguth

@fredguth closing this indeed.

@dominicdev feel free to reach out if you still need help with this and I will reopen it

nsarrazin avatar Jun 19 '23 09:06 nsarrazin

@fredguth im getting this what could be the problem? image

Have the same issue.

  • I have used the vercel adapter in svelte.config.js
  • added all .env variables In Vercel
  • have a mongodb cloud instance MONGODB_URL=mongodb+srv://xxx:[email protected]/?retryWrites=true&w=majority

The app runs locally with no problems. I wonder if it's the initial startup time that takes a few seconds?

This might lead to a timeout of the serverless functions on the free Vercel tier. I notice that even locally the start is not instant but there is some delay. Could this be the issue?

Note that the only change from the default app is the models part in the .env, using a custom endpoint.

MODELS=`[
  {
    "name": "TheBloke/OpenOrca-Preview1-13B-GPTQ",
    "description": "A good alternative to ChatGPT",
    "userMessageToken": "<|### Instruction|>",
    "assistantMessageToken": "<|### Response|>",
    "messageEndToken": "</s>",
    "preprompt": "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n-----\n",
    "parameters": {
      "temperature": 0.7,
      "top_p": 0.95,
      "repetition_penalty": 1.2,
      "top_k": 50,
      "truncate": 1000,
      "max_new_tokens": 1024
    },
"endpoints": [{"url": "endpointURL"}]
  }
]`

BEpresent avatar Jul 19 '23 17:07 BEpresent

This might lead to a timeout of the serverless functions on the free Vercel tier. I notice that even locally the start is not instant but there is some delay. Could this be the issue?

In vercel the app does not work at all? I have seen problems with an inference endpoint that was too slow for vercel, but normally this would happen while trying to use the app (messaging).

If the error is before anything... I would double check if you have all the needed KEYS in the environment.

fredguth avatar Jul 19 '23 17:07 fredguth

This might lead to a timeout of the serverless functions on the free Vercel tier. I notice that even locally the start is not instant but there is some delay. Could this be the issue?

In vercel the app does not work at all? I have seen problems with an inference endpoint that was too slow for vercel, but normally this would happen while trying to use the app (messaging).

If the error is before anything... I would double check if you have all the needed KEYS in the environment.

So it deploys without errors, however then I get the timeout screen from above. Vercel allows copy&pasting the whole env file that I have defined locally and extracts these. The error messages are not very helpful on the Vercel side to debug the issue. My best guess is that the initial startup exceeds 10 seconds which is the max timeout limit on the vercel free tier (locally the UI loads in ~4-5 seconds, also not instant)

This is a screen of the env variables being recognized:

image image

Now when I go to the live url it times out image image

BEpresent avatar Jul 19 '23 18:07 BEpresent

@BEpresent I am having the same issue, did you get this to work?

ghost avatar Aug 14 '23 19:08 ghost

@BEpresent I am having the same issue, did you get this to work?

Unfortunately not, as mentioned my guess would be that the initial startup time causes a timeout on Vercel serverless. Another provider or a Vercel paid tier might be an alternative but I have not tried this yet.

BEpresent avatar Aug 15 '23 00:08 BEpresent

@BEpresent I am having the same issue, did you get this to work?

Unfortunately not, as mentioned my guess would be that the initial startup time causes a timeout on Vercel serverless. Another provider or a Vercel paid tier might be an alternative but I have not tried this yet.

Oh, I actually fixed it, my MongoDB database didn't include 0.0.0.0/0 in the allowed IP addresses list, so it couldn't be accessed from Vercel. It does suck that the error was not showing at all. Maybe you have the same issue

ghost avatar Aug 15 '23 00:08 ghost

@BEpresent I am having the same issue, did you get this to work?

Unfortunately not, as mentioned my guess would be that the initial startup time causes a timeout on Vercel serverless. Another provider or a Vercel paid tier might be an alternative but I have not tried this yet.

Oh, I actually fixed it, my MongoDB database didn't include 0.0.0.0/0 in the allowed IP addresses list, so it couldn't be accessed from Vercel. It does suck that the error was not showing at all. Maybe you have the same issue

Interesting thanks, I will try this out. Indeed, it's not apparent from the error messages.

BEpresent avatar Aug 15 '23 10:08 BEpresent

@BEpresent I am having the same issue, did you get this to work?

Unfortunately not, as mentioned my guess would be that the initial startup time causes a timeout on Vercel serverless. Another provider or a Vercel paid tier might be an alternative but I have not tried this yet.

Oh, I actually fixed it, my MongoDB database didn't include 0.0.0.0/0 in the allowed IP addresses list, so it couldn't be accessed from Vercel. It does suck that the error was not showing at all. Maybe you have the same issue

Interesting thanks, I will try this out. Indeed, it's not apparent from the error messages.

Did it work? Also, I noticed that the vercel serverless function times out after 10 seconds, so it couldn't continue streaming the response when using a self-hosted model. I am using the huggingface inference API now.

ghost avatar Sep 16 '23 19:09 ghost

If anyone finds a solution to this, please post it :) Seems like a massive problem to deploy this anywhere.

mhenrichsen avatar Sep 29 '23 13:09 mhenrichsen

yeah i can't deploy to vercel

haydenkong avatar Jun 06 '24 08:06 haydenkong