The Edge Function "middleware" size is 1.01 MB and your plan size limit is 1 MB

I just started a new Next project with prisma and have configured it as described at https://neon.tech/docs/guides/prisma for Prisma works with the Postgres (Neon) on edge.
After push it the deploy failed on Vercel with the following message: The Edge Function "middleware" size is 1.01 MB and your plan size limit is 1 MB. I am pretty sure it’s an issue once the project is a new and clean project, there is no functions on it, only configurations and connection with the Prisma.
I also ran @next/bundle-analyzer that shows my middleware is less than 300kb Any idea how to fix it?

Hi @felipessantos1. Do you have a minimal reproducible example to investigate the issue?

Hi @amyegan , I just added you to the repo: https://github.com/FelipeSSantos1/brokerwiseflow

Hi @amyegan any luck with that?

The problem in my case was related to prisma adapter

// import { Pool, neonConfig } from "@neondatabase/serverless"
// import { PrismaNeon } from "@prisma/adapter-neon"
import { PrismaClient } from "@prisma/client"
import axios, { AxiosError } from "axios"
import { NextResponse } from "next/server"
// import ws from "ws"

// https://neon.tech/docs/guides/prisma
// neonConfig.webSocketConstructor = ws
// const connectionString = `${process.env.POSTGRES_URL}`

const prismaClientSingleton = () => {
  // const neon = new Pool({ connectionString })
  // const adapter = new PrismaNeon(neon)
  // return new PrismaClient({ adapter })
  return new PrismaClient()
}

We cannot put prisma to run on edge :expressionless:

source: Deploy to Vercel Edge Functions & Middleware | Prisma Documentation

Thanks for coming back to share the answer. The Edge Runtime does have some differences from the Node.js Runtime that are worth considering.

If anyone else finds this post and wants to learn more about the differences, they can find more info in the docs here:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.