Edge Function unsupported module - which was working before

Question

Hi team,

I am suddenly seeing the issue of the vercel deployment failing due to this error

This was working just a week ago. I didn’t make any changes that could have affected any of the packages but now seeing this issue all the time. Also when I tried redeploying the past working build they also keep failing now

Hi @namangarg20, welcome to the Vercel Community!

Sorry that you’re facing this issue. Can you check your code and try to fix the package version in the package.json? Maybe a new version of that package is being installed and it doesn’t work with Edge Runtime.

For anyone having the same issue, the problem comes from exporting the config on the edge functions like this:

export const config = {
  runtime: 'edge',
  regions: ['iad1'],
  // maxDuratioin: 500,
};

export default async (req: Request) => {
...
}

For some reason vercel is throwing an error using that approach. So you should change it to this:

export const runtime = 'edge';

And create your endpoints the same way you do on Next.js:

export const POST = async (req: Request) => {
...
}