I’m building a project that is entirely edge functions, no website/server. I had been experiencing issues with edge functions not deploying, so I updated my netlify-cli. However, now that I’ve updated, I’m getting a weird error when I use the netlify-cli dev server:
◈ Netlify Dev ◈
◈ Ignored general context env var: LANG (defined in process)
◈ No app server detected. Using simple static server
◈ Running static server from "myproj/static"
◈ Setting up local development server
◈ Static server listening to 3999
┌─────────────────────────────────────────────────┐
│ │
│ ◈ Server now ready on http://localhost:8888 │
│ │
└─────────────────────────────────────────────────┘
◈ Loaded edge function root
error: Relative import path "undefined" not prefixed with / or ./ or ../ and not in import map from "file:///var/folders/l_/sw5l9f4s6cq4hlzycrlrxzq40000gs/T/tmp-65293-6WQGSBfgW8Hi/dev.js"
at file:///var/folders/l_/sw5l9f4s6cq4hlzycrlrxzq40000gs/T/tmp-65293-6WQGSBfgW8Hi/dev.js:1:22
◈ Reloading edge functions...
error: Relative import path "undefined" not prefixed with / or ./ or ../ and not in import map from "file:///var/folders/l_/sw5l9f4s6cq4hlzycrlrxzq40000gs/T/tmp-65293-6WQGSBfgW8Hi/dev.js"
at file:///var/folders/l_/sw5l9f4s6cq4hlzycrlrxzq40000gs/T/tmp-65293-6WQGSBfgW8Hi/dev.js:1:22
◈ Failed reloading edge function
I can’t work out what is causing this issue. Here’s my only edge function:
// src/root.ts
import { Config } from "https://edge.netlify.com";
export default async (request: Request) => {
const url = new URL(request.url);
const gif = await (
await fetch(
`https://tenor.googleapis.com/v2/posts?key=${Deno.env.get(
"TENOR_KEY"
)}&ids=${url.pathname.match(/(\d+)\/*$/)?.[1]}&media_filter=gif`
)
).json();
return fetch(gif.results[0].media_formats.gif.url);
};
export const config: Config = {
path: "/view*",
};
and here’s my netlify.toml:
[build]
edge_functions = "src/"
publish = "static/"