Skip to content

[Python templates] Error on deploy after running the api server locally  #1237

@vhvb1989

Description

@vhvb1989

Repro:

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

image

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:

image

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:

  1. 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).
  2. Use a temporal folder when running the app locally. For example /temp/azdlocalrun/api_env.
  3. 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
  4. 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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions