aws / aws-toolkit-jetbrains

AWS Toolkit for JetBrains - a plugin for interacting with AWS from JetBrains IDEs
https://plugins.jetbrains.com/plugin/11349-aws-toolkit
Apache License 2.0
730 stars 197 forks source link

Python Debugger from docker cannot access pydev toolset #4598

Open filipjakubowski opened 1 week ago

filipjakubowski commented 1 week ago

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 )

  1. Create Python CLI Lambda function
  2. Run Debugger

Expected behavior Debugger should run properly

Your Environment

Additional context