aws-toolkit-jetbrains
aws-toolkit-jetbrains copied to clipboard
Python Debugger from docker cannot access pydev toolset
Describe the bug I am trying to debug a lambda function in python using AWS Core and AWS Toolkit. It builds and runs it in docker image. When I run lambda - everything is ok. When I want to debug it it crashes.
/usr/local/bin/sam local invoke CalculateLoanFunction […] --debugger-path /Applications/PyCharm.app/Contents/plugins/python/helpers/pydev […]
Error description suggest potential solution:
Error: 500 Server Error for http+docker://localhost/v1.35/containers/4cdab9fef8a600db6202093e4b40952a78309ca051fb188f8d3e282cfd5cac34/start: Internal Server Error ("Mounts denied:
The path /Applications/PyCharm.app/Contents/plugins/python/helpers/pydev is not shared from the host and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing.
The problem is that on Mac files consistency tool prevents docker to access this resource. After adding it to the path docker cannot start. I can get it working by turning off file consistency on my mac, but this is against security pocicies and I am loosing access to other software that verifies that.
Other solution would be to change path to pycharm debugger path maybe? Have it somehow outside the /Applications/ folder… but I dont know if it is possible?
Workeround Move Pycharm to different directory ( non protected by csrutil )
To reproduce ( Specific to MAC with turned on files consistency that protects access to /Application folder and Docker Desktop that cannot run if path to restricted resource is added )
- Create Python CLI Lambda function
- Run Debugger
Expected behavior Debugger should run properly
Your Environment
- OS: Sonoma 14.5
- JetBrains product: PyCharm
- JetBrains product version: 2024.1.3
- AWS Toolkit version: 3.11-241
- SAM CLI version: 1.116.0
- JVM/Python version: 3.12
Additional context