Edge Functions bundling failed

I’m trying to deploy angular 17 with netlify but I got this error:
11:02:37 PM: Packaging Edge Functions from .netlify/edge-functions directory:
11:02:37 PM: - angular-ssr
11:02:41 PM: error: Uncaught (in promise) Error: Relative import path “fs” not prefixed with / or ./ or …/ and not in import map from “file:///root/dist/server/chunk-IEDXNJZZ.mjs”
11:02:41 PM: const ret = new Error(getStringFromWasm0(arg0, arg1));

Hiya, sorry you are having trouble with your build.

This Support Guide contains a ton of useful debugging tips that can likely help you solve your problem :slight_smile: Additionally, this Support Guide houses all of our resources for debugging build and deploy issues.

If you are still having problems, please provide as much information as you can on what you have already tried, what your build settings are, your package.json, your build log, etc. Thanks!

Hello! I have this error except that in my case it is the ‘crypto’ module. This error occurs during the bundling phase of the edge functions. I found that it could be due to compatibility between node.js (used by angular) and deno used on Netlify edge functions. My theoretical solution is to find a way to get the angular runtime to write the correct import path while writing the edge functions for angular ssr.
I have not found a way to do this. It seems it’s an error from Netlify?
Your help is greatly appreciated. Thank you!

@Adeyossy, always provide a site name when asking for help.

Netlify uses esbuild to transpile the JS and convert it into something that could be run on Deno. You can read about it: Support for npm modules in Edge Functions

Thanks @hrishikesh

I found Firebase was using npm modules undici and grpc/proto-loader that use CommonJS modules instead of ESM and that was what caused the error during the edge-functions bundling phase of Netlify build.

I decided to downgrade the project to Angular v16 which didn’t need SSR (which was the need for edge functions in the first place). I tried an Angular v17 app without SSR but an edge-function seemed to be created for you regardless. I also considered switching to Angular Fire but found it had some compatibility issues with Angular v17 as well. The downgrade seemed to be only option. Glad it worked.

1 Like