# Edge functions do not build

**URL:** <https://answers.netlify.com/t/edge-functions-do-not-build/90070>\
**Category:** Support\
**Tags:** edge\_functions, nextjs\
**Created:** [April 13, 2023, 10:25pm UTC](https://answers.netlify.com/t/edge-functions-do-not-build/90070 "2023-04-13T22:25:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![osseonews](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/osseonews/32/11447_2.png) [@osseonews](https://answers.netlify.com/u/osseonews)\
**Post date:** [April 13, 2023, 10:25pm UTC](https://answers.netlify.com/t/edge-functions-do-not-build/90070/1 "2023-04-13T22:25:23Z")

</div>

We are having continued problems with Edge functions on Nextjs. On some deploys the edge functions get built and work perfectly fine. Then on other builds, the edge functions are supposedly built, but a fetch to the function will return an error that the function is not there (i.e. doesn’t exist). the code on our end hasn’t changed at all. it’s just the deploy is messed up on build. Overall, this is incredibly unreliable. I guess we will have to move back to regular functions, because having the site work on one build and then fail on the next build is not viable. What’s even stranger is the edge functions will work fine on a development branch, and then on production build and vice versa. There is no rhyme or reason here. The logs show the edge functions are built, but they are not there when a fetch is made.

---

<div class="post-metadata">

**Author:** ![osseonews](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/osseonews/32/11447_2.png) [@osseonews](https://answers.netlify.com/u/osseonews)\
**Post date:** [April 14, 2023, 11:58am UTC](https://answers.netlify.com/t/edge-functions-do-not-build/90070/2 "2023-04-14T11:58:11Z")

</div>

Even though, I really don’t understand what is happening behind the scenes with Netlify and NextJs, my guess is that edge functions on Nextjs when hosted on Netlify are unreliable due to occassional build errors when Netlify transforms these functions into Netlify Edge based on Deno. I have no other explanation as to why these functions just randomly fail on some builds and not others. Netlify should use Cloudflare V8 for NextJs Edge functions, like Vercel does, and forget about transforming them. But, this might not be possible b/c Netlify Edge only runs on Deno? If so, I don’t think Deno is a great for edge for Nextjs. Seems very unreliable, at least for NextJs

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [April 16, 2023, 11:50am UTC](https://answers.netlify.com/t/edge-functions-do-not-build/90070/3 "2023-04-16T11:50:24Z")

</div>

We need a site name to check/debug/suggest anything.

---

<div class="post-metadata">

**Author:** ![osseonews](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/osseonews/32/11447_2.png) [@osseonews](https://answers.netlify.com/u/osseonews)\
**Post date:** [April 17, 2023, 7:50pm UTC](https://answers.netlify.com/t/edge-functions-do-not-build/90070/4 "2023-04-17T19:50:24Z")

</div>

We had to refactor into Node, instead of Edge, as Edge was just very unpredictable. There was nothing special about our code. It was simple Edge functions. Plus, we had the same issues as reported here many times on this forum by others. There seems to be some bug in deployment when Netlify transforms NextJs Edge functions in Deno. Sometimes it works and sometimes not. The bugs are: 1. Sometimes edge functions that supposedly are deployed are simply not there. They show in deployment, but calling them returns an error b/c the function is not found. The other error is that often Edge functions will just randomly crash out of nowhere for no apparent reason. Both of these errors have been reported by others, so nothing unique here.

---

<div class="post-metadata">

**Author:** ![SamO](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/samo/32/41847_2.png) [@SamO](https://answers.netlify.com/u/SamO)\
**Post date:** [April 18, 2023, 7:13pm UTC](https://answers.netlify.com/t/edge-functions-do-not-build/90070/5 "2023-04-18T19:13:31Z")

</div>

Hi we will need to know what site you are referring to so we can check and confirm/deny if it’s a bug and help you troubleshoot. Would you mind sharing this or your slug?
