slegay
September 15, 2022, 9:31pm
1
Site: oceg-web-site.
URL: https://www-preview.oceg.org/
We’ve been building this for the past 3 months, everything worked fine, then the past couple of weeks we started getting errors occasionally (same URLs, inconsistent errors), we’ve removed all edge functions except for the one handling 11ty edge, and now after every deploy, every page shows this (nothing in the edge function log, despite multiple log calls). Everything runs great locally on netlify dev server. I’m running out of ideas to debug this.
This edge function has crashed
An unhandled error in the function code triggered the following message:
The deployment failed while serving the request.
Connection details
Netlify internal ID: 01GD1GR2115TH5PD8YGE7P3M2V
slegay
September 15, 2022, 10:28pm
2
I removed ALL edge functions except one, and narrowed down the error to the import statement referencing eleventy:edge.
This line…
import {EleventyEdge} from ‘eleventy:edge’;
breaks the site. This was working find until now. Did support for 11ty edge get removed???
slegay
September 16, 2022, 12:51am
3
Found a solution. Looks like the 11ty author has created a Github repo to manage CDN releases of the Deno plugin: GitHub - 11ty/eleventy-edge-cdn
Changing the reference in the import statement to https://cdn.11ty.dev/edge@2.0.1/eleventy-edge.js fixed the problem.
1 Like
slegay
September 26, 2022, 3:34pm
5
Here’s the official fix from 11ty author:
opened 05:31PM - 22 Sep 22 UTC
closed 05:32PM - 22 Sep 22 UTC
release: canary
feature: 🧀 edge
breaking-change-canary
It looks like deployments relying on the Eleventy [generated import map for Edge… ](https://docs.netlify.com/edge-functions/create-integration/#generate-declarations) are failing. We are going to have to workaround the approach which uses the autogenerated import map. This will allow us to delete some code but will also unfortunately require Edge function `import` statements to change (again).
This will apply to **2.0.0-canary.16** and newer.
## Before
```js
import { EleventyEdge } from "eleventy:edge";
import precompiledAppData from "./_generated/eleventy-edge-app-data.js";
```
## After
```js
import { EleventyEdge, precompiledAppData } from "./_generated/eleventy-edge-app.js";
```
## Error message
We’ll also throw a build-time error message for you with instructions:
> Experimental early adopter API change alert! Unfortunately the default imports for Eleventy Edge in the latest canary have changed. The easiest thing you can do is delete your existing `netlify/edge-functions/eleventy-edge.js` and let Eleventy generate a new one for you. The new import should be `import { EleventyEdge, precompiledAppData } from "./_generated/eleventy-edge-app.js";`
## Shout outs
cc @mirisuzanne and @slegay and @MarcL who seem to have been asking around on this one!
(Also ran into #2571 while debugging this)
1 Like
hillary
September 26, 2022, 9:20pm
6
Thanks so much for coming back and sharing that! Glad you found the solution.