I already have my web application working in development and I did a build and everything is ok, but when I do a deploy in vercel I have a problem, I get this:
This Edge Function has crashed.
Your connection is working correctly.
Vercel is working correctly.
500: INTERNAL_SERVER_ERROR
Code: EDGE_FUNCTION_INVOCATION_FAILED
ID: iad1::cxlzh-1681998566052-211bcd671c20
Hi @MaxCoding ,
Welcome to the builder.io forum.
You may find help at the below GitHub reported issue
opened 03:50PM - 08 Nov 21 UTC
closed 06:19PM - 01 Feb 22 UTC
kind: bug
area: SWC Minify
### What version of Next.js are you using?
12.0.3
### What version of Node… .js are you using?
14.18.1
### What browser are you using?
Chrome
### What operating system are you using?
macOS
### How are you deploying your application?
Vercel
### Describe the Bug
The edge functions are crashing when deployed to Vercel
> This is the error
TypeError: (intermediate value)(intermediate value).push(...) is not a function
at Object.<anonymous>
### Expected Behavior
The edge function should redirect to the login page if the cookie is not found
### To Reproduce
create _middleware.tsx file and add the following content.
```
import type { NextRequest } from "next/server";
import { NextResponse } from "next/server";
export const middleware = (req: NextRequest) => {
const cookie = req.cookies["auth"];
if (!cookie) {
return NextResponse.redirect("/login");
}
};
```
Let us know if this doesn’t help. Thank you!