cli icon indicating copy to clipboard operation
cli copied to clipboard

Edge Functions are not deployed

Open ShogunPanda opened this issue 7 months ago • 1 comments

Describe the bug

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

ShogunPanda avatar Jan 10 '24 15:01 ShogunPanda

$ find dist/
# dist/
# dist//html
# dist//html/index.html
# ...
# dist//functions
# dist//functions/events-injector.js

ShogunPanda avatar Jan 10 '24 15:01 ShogunPanda

Any update on this?

ShogunPanda avatar Feb 29 '24 09:02 ShogunPanda

Hi @ShogunPanda,

You can ask for help with usage of Netlify and the Netlify CLI over in our forums: https://answers.netlify.com/

In this specific case, try running NETLIFY_SITE_ID=... netlify deploy --build --prod and see if that makes it work with recent versions of the CLI. If not, please ask over in the forums and you'll get answers more quickly there.

ramonsnir avatar Feb 29 '24 14:02 ramonsnir

@ramonsnir I tried and nothing changed. Instead, I noticed that if I run cd dist && NETLIFY_SITE_ID=... netlify deploy --build --prod it works instead.

Anyway, I created the thread https://answers.netlify.com/t/edge-functions-are-not-deployed/113900

ShogunPanda avatar Mar 06 '24 07:03 ShogunPanda

For anybody running into this. This has been solved in https://answers.netlify.com/t/edge-functions-are-not-deployed/113900/12

The key is to add a dummy command in the build section. Like:

[build]
# ...
command = "true"
# ...

ShogunPanda avatar Mar 29 '24 06:03 ShogunPanda