netlify / cli

Netlify Command Line Interface
http://cli.netlify.com
MIT License
1.58k stars 352 forks source link

Netlify CLI not consistently reloading edge functions when file is overwritten #5494

Open wesbos opened 1 year ago

wesbos commented 1 year ago

Describe the bug

I am using remix with the @netlify/remix-edge-adapter. This bundles the remix server into an edge function at ./netlify/edge-functions/server.js

When I change a file that rebuilds the server, the above file is updated, but netfliy CLI doesn't realize a change, and thus doesn't reload function, so every time I make a change, I have to kill netlify dev and restart it. It does seem to work about 1 in 5-15 saves.

Video here of me replicating it: https://share.getcloudapp.com/L1uDojBD

Note it says "serving cache" in my logs- this has nothing to do with the edge function and isn't the issue here. https://wes.io/L1uDojBD

Steps to reproduce

see above

Configuration

[build] command = "remix build" publish = "public"

[dev] command = "remix watch" port = 3000 autoLaunch = false

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

Environment

System: OS: macOS 13.0 CPU: (10) arm64 Apple M1 Max Memory: 5.18 GB / 64.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 18.12.1 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 9.5.0 - /usr/local/bin/npm npmGlobalPackages: netlify-cli: 12.14.0

nickytonline commented 1 year ago

I looked at this briefly, and it doesn't appear to be frameworks related.

I thought maybe the cache: "manual" key (edge function caching) in the in-source config for the Netlify Edge Function that handles remix requests might have somehow been affecting local development, but @wesbos confirmed the same behaviour occurs without cache: "manual" set.

khendrikse commented 1 year ago

@wesbos Thanks so much for opening up this issue ☺️ we released a new version of the CLI, namely v.13.1.5 which I hope solves this issue :) in case it didn't, please feel free to let us know!

wesbos commented 1 year ago

@khendrikse Thank you - seems like that didn't fix it though.

netlify-cli/13.1.6 darwin-arm64 node-v18.12.1

I have to hit reload between 5-40 times in order for it to reload the edge functions.

Also, @nickytonline I find that when it does trigger properly, the remix server refreshes before the compiled edge function is done, so I either see a broken page, or the old server info.

khendrikse commented 1 year ago

@wesbos thanks for checking it out :) we'll dive in again!