How to setup Next js apps on Vercel using Prisma....
Unanswered
Bayrem posted this in #help-forum
BayremOP
I've been fighting bugs for ages, Mye learning journey is stuck for months just because i couldn't find a way to deploy my next js app on vercel that uses Prisma and MongoDB, I really have a question
How to deploy on vercel with my prisma powered next app? Can I use accelerate on vercel?
here are my files and how I use them:
My app works fine locally, build and deploys with no problems, but requests doesn't go through from the actual website online
U guys have no idea how much it will help me if u solve this issue for me 🙏
How to deploy on vercel with my prisma powered next app? Can I use accelerate on vercel?
here are my files and how I use them:
import prisma from "@/lib/db";
import React from "react";
const handleSubmit = async (formData: FormData) => {
"use server";
const source = formData.get("source");
try {
const submit = await prisma.test.create({
data: {
source: source as string,
},
});
} catch (error) {
console.log(error);
throw new Error("Something went wrong");
}
};
const Form = () => {
return (
<div>
<form action={handleSubmit}>
<input name="source" type="text" />
<button>Submit</button>
</form>
</div>
);
};
export default Form;import { PrismaClient } from "@prisma/client";
const prismaClientSingleton = () => {
return new PrismaClient();
};
declare const globalThis: {
prismaGlobal: ReturnType<typeof prismaClientSingleton>;
} & typeof global;
const prisma = globalThis.prismaGlobal ?? prismaClientSingleton();
export default prisma;
if (process.env.NODE_ENV !== "production") globalThis.prismaGlobal = prisma;My app works fine locally, build and deploys with no problems, but requests doesn't go through from the actual website online
U guys have no idea how much it will help me if u solve this issue for me 🙏
5 Replies
American Crow
You'll have to look up the server logs on Vercel and post the error here. Nobody here got a crystal ball
@joulev > How can I deploy on vercel
Just deploy normally.
> can I use accelerate
Yes
BayremOP
wish it was that easy bro, i have free tier i've been dighting to deploy in vercel for months now and it just always 504's me
Well then add more info to question. What error? What shows up on the server log?
After a long time without many responses, you can probably tell this question has too little answer for anyone to answer