š Bug Report: Hot-swapping breaks when function is running locally
š Reproduction steps
- Create a new Appwrite project with a starter function using
python-ml-3.11. - Run it with
appwrite run function - Trigger a save action on
src/main.py
š Expected behavior
Hot-swapping to work. Workaround is to edit node_modules/appwrite-cli/lib/utils.js#L12 with fs.lstatSync which doesn't follow symlinks.
š Actual Behavior
ā¹ Info: Starting function using Docker ...
ā„ Hint: Function automatically restarts when you edit your code.
Preparing for start ...
ā Success: Visit http://localhost:3000/ to execute your function.
Starting ...
ā¹ Info: Hot-swapping function.. Files with change are src/main.py
Error: ENOENT: no such file or directory, stat '/Users/kamar/Projects/appwrite/functions/My Awesome Function/.appwrite/hot-swap/runtime-env/bin/python'
at Object.statSync (node:fs:1658:25)
at getAllFiles (/Users/kamar/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/appwrite-cli/lib/utils.js:12:16)
at getAllFiles (/Users/kamar/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/appwrite-cli/lib/utils.js:13:27)
at getAllFiles (/Users/kamar/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/appwrite-cli/lib/utils.js:13:27)
at getAllFiles (/Users/kamar/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/appwrite-cli/lib/utils.js:13:27)
at getAllFiles (/Users/kamar/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/appwrite-cli/lib/utils.js:13:27)
at EventEmitter.<anonymous> (/Users/kamar/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/appwrite-cli/lib/commands/run.js:258:37) {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: '/Users/kamar/Projects/appwrite/functions/My Awesome Function/.appwrite/hot-swap/runtime-env/bin/python'
}
^Cā¹ Info: Cleaning up ...
ā Success: Local function successfully stopped.
### š² Appwrite version
Appwrite Cloud
### š» Operating system
MacOS
### š§± Your Environment
[email protected]
### š Have you spent some time to check if this issue has been raised before?
- [x] I checked and didn't find similar issue
### š¢ Have you read the Code of Conduct?
- [x] I have read the [Code of Conduct](https://github.com/appwrite/.github/blob/main/CODE_OF_CONDUCT.md)
I just encountered the same issue while running a Python function locally with Appwrite CLI 6.2.2.
š My Environment:
- OS: Ubuntu 22.04
- Appwrite CLI Version: 6.2.2
- Python Version: 3.12.3
- Function Runtime: Python 3.12
- Docker Installed: Yes
š Issue Details:
Whenever I modify my function's code (even a single character), Appwrite detects the change and attempts to hot-swap the function. However, instead of applying the update correctly, it throws the same ENOENT error, failing to locate the Python binary inside .appwrite/hot-swap/runtime-env/bin/python.
ā ļø Error Output:
ā¹ Info: Hot-swapping function.. Files with change are src/main.py Error: ENOENT: no such file or directory, stat '/home/atlasdev/projects/tasknotes/functions/Function Sample/.appwrite/hot-swap/runtime-env/bin/python' at Object.statSync (node:fs:1688:3) at getAllFiles (/usr/local/lib/node_modules/appwrite-cli/lib/utils.js:12:16) ...
š Additional Findings:
I noticed that in .appwrite/hot-swap/runtime-env/bin/, the python, python3, and python3.12 binaries are symbolic links, but they appear to be broken (they don't point to valid files). This seems to be why stat fails when attempting to locate the binary.
Has there been any progress on fixing this in newer versions? If there's anything I can test to help debug, let me know!
Thanks!
@kamarkiewicz @TechAtlasDev thanks for raising the issue! seems like the issue might be isolated to python functions specifically as i just tried a node function and it worked with no issues.
I will begun investigation on this and let you know if a fix is available š