cli icon indicating copy to clipboard operation
cli copied to clipboard

Functions watcher Appears Not to Work

Open ronen25 opened this issue 2 years ago • 17 comments

Bug report

Describe the bug

After running supabase functions serve on a newly-created hello function, I expect to see the function hot-reload after changing the index.ts file of the function, but nothing seems to happen.

I see this message which indicates that serve worked, but again, hot-reloading the function does not seem to work:

Starting supabase/functions/hello
Serving supabase/functions/hello
Watcher Process started.
Hello from Functions!

To Reproduce

  1. Run supabase functions new hello
  2. Leave everything as-is in the index.ts file
  3. Run supabase start
  4. Run supabase functions serve hello
  5. See 'Hello Functions!' printed - expected result.
  6. Make any change in index.ts - for this example I made a change to the output message
  7. 'Hello functions' is still printed, instead of the new output message. Also, there appears to be no status updates from the watcher.

Expected behavior

Expected the function to hot-reload.

System information

  • OS: [e.g. macOS, Windows] Windows 11
  • Browser (if applies) [e.g. chrome, safari] Independent
  • Versions: CLI version 0.24.2, Deno: deno 1.20.4 (release, x86_64-pc-windows-msvc) v8 10.0.139.6 typescript 4.6.2 supabase-js: 1.33.3
  • Version of Node.js: v16.14.0

Additional context

Tried running serve from an Administrative Powershell and Admin. CMD - same result.

ronen25 avatar Apr 08 '22 13:04 ronen25

This seems to be a limitation of Docker on Windows: https://forums.docker.com/t/file-system-watch-does-not-work-with-mounted-volumes/12038

The workaround mentioned in that thread is to do the file watching ourselves natively, but that involves a lot of work - happy to hear any alternatives.

soedirgo avatar Apr 11 '22 05:04 soedirgo

Facing the same issue...

pravinfullstack avatar May 27 '22 05:05 pravinfullstack

There's an old post that works for others but I can't get this to work. Anyone more luck?

http://blog.subjectify.us/miscellaneous/2017/04/24/docker-for-windows-watch-bindings.html

@soedirgo This seems to be caused by the incorrect path being exposed:

WARNING:root:Bind of container supabase_deno_relay_edge-functions was skipped since it has invalid source path C:\supabase\examples\edge-functions/supabase/functions

Notice the change in backslash to slash. The Python script would work if the mount would be 'correct'

EDIT: I did it! AAAAAAH! This makes my life so much easier dealing with Edge Functions. Wow.

Serving supabase/functions/select-from-table-with-auth-rls
Watcher Process started.
Function "select-from-table-with-auth-rls" up and running!
Watcher File change detected! Restarting!
Check file:///home/deno/functions/select-from-table-with-auth-rls/index.ts
Function "select-from-table-with-auth-rls" up and running!
Watcher File change detected! Restarting!
Function "select-from-table-with-auth-rls" up and running!

Steps to get to the same outcome:

  1. Go to https://github.com/merofeev/docker-windows-volume-watcher and download the source
  2. Change the file container_monitor.py to the following contents: https://pastebin.com/raw/07uxv9gG You can read more about these changes in this issue: https://github.com/merofeev/docker-windows-volume-watcher/issues/18
  3. Download auto-py-to-exe here https://github.com/brentvollebregt/auto-py-to-exe
  4. Start auto-py-to-exe and create a new exe file from the cli.py file
  5. Start the cli.exe
  6. Success!

arvalaan avatar Jun 18 '22 20:06 arvalaan

Good find! The mount path thing is a bug - will work on a fix.

soedirgo avatar Jun 20 '22 05:06 soedirgo

hey , a guest from the dystopian '23 here 😀.

the issue still persists on docker windows. any chance for a patch in the cli?

kaminskypavel avatar Feb 14 '23 10:02 kaminskypavel

Hi! Just here to ask for any updates in the issue. Still persist up to date.

JOYBOY-0 avatar Apr 21 '23 21:04 JOYBOY-0

I hate to do this, but I third the request to prioritize fixing this issue.

noga-dev avatar May 20 '23 13:05 noga-dev

issue on Docker macOs too

Bijig0 avatar Jan 05 '24 21:01 Bijig0

Still facing this issue on Mac. Even stopping/restarting supabase does not pickup new function changes. @Bijig0 did you ever solve for mac?

AakashKB avatar May 22 '24 01:05 AakashKB

Still facing this issue on Mac. Even stopping/restarting supabase does not pickup new function changes. @Bijig0 did you ever solve for mac?

Unfortunately not, I personally switched to vercel cloud functions

Bijig0 avatar May 22 '24 06:05 Bijig0

I can confirm that I'm experiencing the same issues. A full Docker restart is required to run updates locally on mac.

Docker Desktop 4.30.0 supabase/postgres 15.1.1.33 supabase/edge-runtime 1.45.2

JanKups avatar May 22 '24 10:05 JanKups