Azure / Azure/azure-cli-extensions

Exception was thrown when create container app with `docker-compose.yml`

Open
#6,217 6 comments 1 reaction 0 assignees View on GitHub
Auto-Assign ContainerApp customer-reported needs-team-attention question Service Attention
Dominant language
Python
Stars
454
Forks
1.7k
Avg merge
2d 19h
Merged PRs (30d)
64

Description

### **This is autogenerated. Please review and update as needed.**

## Describe the bug

**Command Name**
`az containerapp compose create
Extension Name: containerapp. Version: 0.3.28.`

**Errors:**
```
The command failed with an unexpected error. Here is the traceback:
'NoneType' object is not iterable
Traceback (most recent call last):
File "/opt/homebrew/Cellar/azure-cli/2.47.0/libexec/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/homebrew/Cellar/azure-cli/2.47.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
raise ex
File "/opt/homebrew/Cellar/azure-cli/2.47.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/opt/homebrew/Cellar/azure-cli/2.47.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
result = cmd_copy(params)
File "/opt/homebrew/Cellar/azure-cli/2.47.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
return self.handler(*args, **kwargs)
File "/opt/homebrew/Cellar/azure-cli/2.47.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
return op(**command_args)
File "/Users/beohoang98/.azure/cliextensions/containerapp/azext_containerapp/custom.py", line 4136, in create_containerapps_from_compose
environment = resolve_environment_from_service(service)
File "/Users/beohoang98/.azure/cliextensions/containerapp/azext_containerapp/_compose_utils.py", line 211, in resolve_environment_from_service
env_vars = service.resolve_environment_hierarchy()
File "/Users/beohoang98/.azure/cliextensions/containerapp/pycomposefile/service/service.py", line 141, in resolve_environment_hierarchy
env_file.update(self.environment)
TypeError: 'NoneType' object is not iterable
```

## To Reproduce:
Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

- I have a `docker-compose.yml` file that like this
```yml
version: "3"

services:
rails_app:
image: "custom_public_image"
#...
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
db:
image: "postgres"
redis:
image: "redis"

```
- `az containerapp compose create --environment -l eastasia`
- Two container `db` and `redis` was created on the Azure Portal, the error happens and remain container was not created

## Expected Behavior

I guess `containerapp` might not support something but the error should show correctly what wrong or what cannot be done rather than python exception `NoneType`

## Environment Summary
```
macOS-13.3.1-arm64-arm-64bit, Darwin 22.4.0
Python 3.10.11
Installer: HOMEBREW

azure-cli 2.47.0

Extensions:
containerapp 0.3.28
deploy-to-azure 0.2.0

Dependencies:
msal 1.20.0
azure-mgmt-resource 22.0.0
```
## Additional Context

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.