supabase / cli

Supabase CLI. Manage postgres migrations, run Supabase locally, deploy edge functions. Postgres backups. Generating types from your database schema.
https://supabase.com/docs/reference/cli/about
MIT License
958 stars 179 forks source link

Functions watcher Appears Not to Work #247

Open ronen25 opened 2 years ago

ronen25 commented 2 years ago

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

Additional context

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

soedirgo commented 2 years ago

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.

power-cut commented 2 years ago

Facing the same issue...

arvalaan commented 2 years ago

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!
soedirgo commented 2 years ago

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

kaminskypavel commented 1 year ago

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

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

JOYBOY-0 commented 1 year ago

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

noga-dev commented 1 year ago

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

Bijig0 commented 6 months ago

issue on Docker macOs too

AakashKB commented 1 month ago

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

Bijig0 commented 1 month ago

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

JanKups commented 1 month ago

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

alexgshaw commented 1 month ago

Also not working for me:

Supabase cli: 1.172.2 Deno: 1.40.3 edge-runtime:v1.53.3

alexgshaw commented 1 month ago

I just upgraded to the latest CLI and still not working.

CLI: 1.176.10 Edge runtime: 1.54.2

FYI I'm using a MacBook Pro with an Intel chip.

JanKups commented 2 weeks ago

@sweatybridge Any chance this issue will be picked up?