Repro:
- azd init -t todo-python-mongo
- azd provision
- azd deploy
- VSCode-> Run Task -> Start API (wait until the api is lauched)
- azd deploy:

Root Cause:
When the api is launched locally, a new folder is created inside the /api folder called api_env. This folder contains a virtual python environment where the application dependencies are installed and where the application is launched from.
Inside this folder, there are some folders which are symLinks to python binaries, like lib64:

When azd deploy runs, a zip file is created including all the content from /api folder, and the create zip implementation from azd does not support symLinks (it doesn't see it as a folder, but as a file, and failed to zip it).
As a workaround, before running azd deploy, we can delete the api_env.
Fix proposals:
- Make
azd to support excluding known folders while doing deploy. The python implementation, for example, should tell azd to ignore the api_env folder when doing deploy. With this approach, we could also skip adding the __pycache__ folders to the zip (those folders are created when running the app locally as well).
- Use a temporal folder when running the app locally. For example
/temp/azdlocalrun/api_env.
- Use
azure.yaml or an extra file (like app.deploy.ignore) to define files/folder which should not be zipped and deployed to Azure. This strategy would allow customers to have control over the deployment files without depending on azd
- Combine option 1 and 3, where
azd would have a hardcoded list of ignore paths and users can also extend the list with configuration files.
Repro:
Root Cause:
When the
apiis launched locally, a new folder is created inside the/apifolder calledapi_env. This folder contains a virtual python environment where the application dependencies are installed and where the application is launched from.Inside this folder, there are some folders which are
symLinksto python binaries, likelib64:When
azd deployruns, a zip file is created including all the content from/apifolder, and thecreate zipimplementation fromazddoes not supportsymLinks(it doesn't see it as a folder, but as a file, and failed to zip it).As a workaround, before running
azd deploy, we can delete theapi_env.Fix proposals:
azdto support excluding known folders while doingdeploy. Thepythonimplementation, for example, should tellazdto ignore theapi_envfolder when doingdeploy. With this approach, we could also skip adding the__pycache__folders to the zip (those folders are created when running the app locally as well)./temp/azdlocalrun/api_env.azure.yamlor an extra file (likeapp.deploy.ignore) to define files/folder which should not be zipped and deployed to Azure. This strategy would allow customers to have control over the deployment files without depending onazdazdwould have a hardcoded list ofignore pathsand users can also extend the list with configuration files.