Netlify CLI fails to build Edge Functions locally with Deno v1.45.0

Netlify CLI used to build edge functions just fine when using command npx netlify deploy --build with older Deno versions (as far as I remember, it was Deno v1.39 or something around it).

However, it started failing with the latest update of Deno to v1.45.0 with the following error:

Could not load configuration for edge function at '***/netlify/edge-functions/html-entry.ts'
error: TypeScript files are not supported in npm packages: file:///***/node_modules/netlify-cli/node_modules/@netlify/edge-bundler/deno/config.ts

It first started happening on CI only, and I couldn’t find the issue locally until I removed the cached Deno version from ~/Library/Preferences/netlify/deno-cli (used to be something like v1.39, can’t remember the exact version) on Mac. After it was removed, netlify-cli downloaded a newer version of Deno (1.45.0) and the error started appearing locally as well.

Is there any way to fix the issue?

Hi @maksim.kalinin!

Sorry to hear you’re hitting this problem.

Can you share the import statements you have in your edge function? Are you using any npm packages?

Thanks.

The only import I have in edge functions is the following:

import type { Config } from 'https://edge.netlify.com/';

I was able to find out that the problem starts happening only with Deno 1.45.0 (by adjusting DENO_VERSION_RANGE variable inside @netlify/edge-bundler/node/bridge.js file), so Deno 1.44.0 works fine and can build the edge functions.

Thanks for that context. I still want to understand what is causing the problem with version 1.45.0.

Can you confirm what command are you running? ntl build or ntl deploy?

It happens during the build command: npx netlify build.

While we investigate, we’ll release a new version of the CLI that pins the version of the Deno CLI to <1.45.0. I’ll update this thread once that release is out.

Thanks for your patience!

1 Like

Thank you!

If it helps, I investigated it a bit further and found out that with the latest version of Deno you cannot run any .ts scripts that are located inside node_modules folder.

For instance, if a file is located in the root of a project, I can run it with deno run ./test.ts. While if I put it inside node_modules, it will fail: deno run node_modules/test.ts.

2 Likes

Thanks, @maksim.kalinin. I appreciate the help. We’re looking into it.

In the meantime, we’ve released a patch as version 17.33.1 of the Netlify CLI. Could you try upgrading and letting us know if you still experience the issue?

1 Like

I confirm that 17.33.1 version fixes the issue. Thank you for a quick fix!

2 Likes