aws-amplify / aws-amplify/amplify-hosting

Amplify REST API Python error when deploying due to 3.7 in aws build

Open
#2,983 10 comments 1 reaction 0 assignees View on GitHub
backend-builds usability
Dominant language
Dockerfile
Stars
481
Forks
123
PR merge metrics
No merged PRs in 30d

Description

### Before opening, please confirm:

- [X] I have checked to see if my question is addressed in the [FAQ](https://github.com/aws-amplify/amplify-hosting/blob/master/FAQ.md).
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-hosting/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-hosting/blob/master/CONTRIBUTING.md).
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

### App Id

d8nzd3pgncdfk

### Region

us-east-1

### Amplify Hosting feature

Backend builds, Build settings

### Describe the bug

In local, it can works well. However, it is error when deploying using Amplify hosting CI/CD flow. My app requires python 3.8 for Amplify REST API Python, however, the build image in aws using python 3.7.

```bash
## Checking for associated backend environment...
## Backend environment association found
2022-09-12T12:50:25.533Z [INFO]: Amplify AppID found: d8nzd3pgncdfk. Amplify App name is: kendrademo
2022-09-12T12:50:25.592Z [INFO]: Backend environment dev found in Amplify Console app: kendrademo
2022-09-12T12:50:26.094Z [WARNING]: - Fetching updates to backend environment: dev from the cloud.
2022-09-12T12:50:26.635Z [WARNING]: - Building resource api/api1ed17962
2022-09-12T12:50:26.652Z [WARNING]: ✔ Successfully pulled backend environment dev from the cloud.
2022-09-12T12:50:26.665Z [INFO]: ✅
2022-09-12T12:50:27.906Z [INFO]: Note: It is recommended to run this command from the root of your app directory
2022-09-12T12:50:28.711Z [WARNING]: - Initializing your environment: dev
2022-09-12T12:50:29.223Z [WARNING]: - Building resource api/api1ed17962
2022-09-12T12:50:29.239Z [WARNING]: ✔ Initialized provider successfully.
2022-09-12T12:50:29.623Z [INFO]: python3 found but version Python 3.7.10 is less than the minimum required version.
You must have python >= 3.8 installed and available on your PATH as "python3" or "python". It can be installed from https://www.python.org/downloads
You must have pipenv installed and available on your PATH as "pipenv". It can be installed by running "pip3 install --user pipenv".
You must have virtualenv installed and available on your PATH as "venv". It can be installed by running "pip3 install venv".
2022-09-12T12:50:29.624Z [WARNING]: ✖ There was an error initializing your environment.
2022-09-12T12:50:29.627Z [INFO]: Error: Missing required dependencies to package kendrademoda6c4ec6
 at buildFunction (/snapshot/repo/build/node_modules/amplify-category-function/lib/provider-utils/awscloudformation/utils/buildFunction.js:13:15)
 at processTicksAndRejections (internal/process/task_queues.js:95:5)
 at async prepareResource (/snapshot/repo/build/node_modules/amplify-provider-awscloudformation/lib/push-resources.js:559:33)
 at async Promise.all (index 0)
 at async prepareBuildableResources (/snapshot/repo/build/node_modules/amplify-provider-awscloudformation/lib/push-resources.js:555:3)
 at async Object.run (/snapshot/repo/build/node_modules/amplify-provider-awscloudformation/lib/push-resources.js:217:5)
2022-09-12T12:50:29.642Z [ERROR]: !!! Build failed
2022-09-12T12:50:29.642Z [ERROR]: !!! Non-Zero Exit Code detected
2022-09-12T12:50:29.642Z [INFO]: # Starting environment caching...
2022-09-12T12:50:29.643Z [INFO]: # Environment caching completed
Terminating logging...
```

### Expected behavior

The aws build image should support python 3.8 so it can works for Amplify Rest Api python

### Reproduction steps

Follow this official document to add an rest api in python and deploy by amplify CI/CD

https://docs.amplify.aws/cli/function/

### Build Settings

```yaml
version: 1
frontend:
phases:
preBuild:
commands:
- npm ci --force
build:
commands:
- npm run build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
```

### Additional information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the Amplify Hosting build-image configuration and the backend build settings shown in the issue, then reproduce the failure using the linked Python REST API guide and the provided App ID and region. Trace where the build image selects and exposes Python, and verify the deployment completes with the required Python version and dependencies.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
backend, build-system, ci-cd, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.