Edge Functions are not deployed

Follow up of: Edge Functions are not deployed · Issue #6298 · netlify/cli · GitHub

Hi!
When I run:

NETLIFY_SITE_ID=... netlify deploy --prod

The edge function is not deployed, the rest of the site deployed correctly.
This issue happens with any @netlify/cli 16.x or 17.x, while 15.x is ok.

Steps to reproduce

Run:

NETLIFY_SITE_ID=... netlify deploy --prod

Configuration

[build]
base = "dist"
publish = "html"
edge_functions = "functions"

[[edge_functions]]
path = "/"
function = "events-injector"
cache = "manual"

[[headers]]
for = "*.png"

[headers.values]
Cache-Control = "public, s-maxage=31536000, max-age=31536000"

[[headers]]
for = "*.webp"

[headers.values]
Cache-Control = "public, s-maxage=31536000, max-age=31536000"

[[headers]]
for = "*.woff2"

[headers.values]
Cache-Control = "public, s-maxage=31536000, max-age=31536000"

[[headers]]
for = "*.json"

[headers.values]
Cache-Control = "public, s-maxage=31536000, max-age=31536000"

[[headers]]
for = "*.js"

[headers.values]
Cache-Control = "public, s-maxage=31536000, max-age=31536000"

[[headers]]
for = "sw.js"

[headers.values]
Cache-Control = "s-maxage=0, max-age=0, no-cache, no-store, must-revalidate"

Environment

  System:
    OS: macOS 14.2.1
    CPU: (12) arm64 Apple M2 Max
    Memory: 12.13 GB / 64.00 GB
    Shell: 3.6.0 - /opt/homebrew/bin/fish
  Binaries:
    Node: 20.8.0 - /usr/local/bin/node
    Yarn: 1.22.21 - /usr/local/bin/yarn
    npm: 10.1.0 - /usr/local/bin/npm
    pnpm: 8.13.1 - /usr/local/bin/pnpm
  npmGlobalPackages:
    netlify-cli: 17.13.0

Additional info

I’ve tried adding --build as requested on GitHub with no luck.

I noticed that if I instead do cd dist && NETLIFY_SITE_ID=... netlify deploy --prod it works instead.

Mind sharing a repo that we can reproduce the issue on? I’m currently able to deploy Edge Functions just fine using any of the mentioned versions of the CLI.

One note though, I believe version 16 was the one that brought some monorepo specific changes with it: Release v16.0.0 · netlify/cli · GitHub. So that’s why things might be working differently in your case since then.

If you give me your GitHub handle I can temporarily grant you access to the repo that was causing issues.

You may share it with: hrishikesh-k (Hrishikesh Kokate) (github.com)

Done!
Let me know how it goes :slight_smile:

In your repo, I don’t see a dist directory, but your base is set to dist. Is ths expected?

Yes, you have to run npm run build first.

That doesn’t work:

npm run build

> www@3.0.0 build
> dante build

[16:08:37.648] INFO (16266): Compiling Typescript ...
[16:08:39.516] INFO (16266): TypeScript compilation completed in 1865.348 ms.
[16:08:39.516] INFO (16266): Preparing syntax highlighting ...
[16:08:39.667] INFO (16266): Syntax highlighting prepared in 151.215 ms.
[16:08:39.958] ERROR (16266): Building failed after 291.001 ms:

    Error [ERR_MODULE_NOT_FOUND]: Cannot find module '$ROOT/node_modules/@fortawesome/free-brands-svg-icons/faXtwitter.js' imported from $ROOT/.dante/styling/icons.js
      at finalizeResolution (node:internal/modules/esm/resolve:264:11)
      at moduleResolve (node:internal/modules/esm/resolve:917:10)
      at defaultResolve (node:internal/modules/esm/resolve:1130:11)
      at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12)
      at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25)
      at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38)
      at ModuleLoader.import (node:internal/modules/esm/loader:328:34)
      at importModuleDynamically (node:internal/modules/esm/translators:158:35)
      at importModuleDynamicallyCallback (node:internal/modules/esm/utils:207:14)
      at loadIcons (file://$ROOT/.dante/styling/icons.js:33:43)


> www@3.0.0 postbuild
> concurrently npm:lint npm:lint:css npm:typecheck

[lint:css] 
[lint:css] > www@3.0.0 lint:css
[lint:css] > stylelint --cache src/**/*.css
[lint:css]
[lint] 
[lint] > www@3.0.0 lint
[lint] > eslint --cache --ext .js,.jsx,.ts,.tsx src
[lint]
[typecheck] 
[typecheck] > www@3.0.0 typecheck
[typecheck] > tsc -p . --noEmit
[typecheck]
[lint:css] npm run lint:css exited with code 0
[typecheck] npm run typecheck exited with code 0
[lint] npm run lint exited with code 0

The dist folder is empty.

I assume you ran npm install, isn’t it?

Indeed. If I had not done it, I don’t believe rest of the commands would have ran before it.

Ok, it works now, I just updated the code.
Apparently I never tested it on a case-sensitive file-system :slight_smile:

Based on your setup, I believe you simply need to add

  command = "echo Hi!"

to the [build] block in your netlify.toml.

Thank you so much! :heart:

A simple

command = "true"

made the trick. Never thought about it.

1 Like