Hello,
I’m excited to try out the new Netlify Edge Functions beta, but I’m running into an error without any actionable information so I could use some help to figure out next steps.
An unhandled error in the function code triggered the following message:
The deployment failed while serving the request.
Connection details
Netlify internal ID: 01G16QHZAKGBA82DBPFR503FRZ
You can see the error here: https://6261a5485d2ff70009f76bbc--precious-figolla-e4e921.netlify.app/my/netlify/edge/function.
In the edge function logs I see this:
11:45:49 AM: ReferenceError: Z_VERSION_ERROR is not defined
at netlify:bundle-combined:47037:22
The build succeeded, so it seems like the deno bundle was successful, so I’m not sure what I should be looking at to try to fix the error.
For context, my edge_handler config in my netlify.toml
looks like this:
[[edge_functions]]
path = "/my/netlify/edge/function"
function = "server-render"
(Here’s the full context in the GitHub repo).
I’m testing out an adapter for a frontend framework I maintain, elm-pages.
There are two areas I can think of to look for errors, but since it seems like the deno bundle step is succeeding I’m not sure if that means the problem is elsewhere.
- I’m using a CommonJS-style require. I need to do this to pull in the compiled Elm code. I had to use version 0.130.0 of deno std instead of the latest (0.136.0) to avoid an error that came up from unstable API references, so this is what that code looks like (full code snippet on GitHub):
import { createRequire } from "https://deno.land/std@0.130.0/node/module.ts";
const require = createRequire(import.meta.url);
- I am require’ing some modules using relative paths. Like
require("../../../../../generator/src/render");
. So I wonder if the paths could be different in the build environment (or the deployed environment). Maybe the Deno bundle step succeeds because the bundling only happens for ESM imports, and the CommonJS require happens dynamically. Could this be the source of the error? And if so, is it possible for me to reference some of the source code from the git repo within my edge functions? Is there a way to make sure those files are included without copying them, or is copying them the recommended practice?
I hope that’s enough context to be an actionable question. Thanks for any insights on this!