3 回答
- 最新
- 投票最多
- 评论最多
0
Try cleaning the build cache and re-building:
sam build --no-cached --debug
0
The error indicates an issue with encoding when resolving dependencies for the Python 3.12 runtime.
- Ensure your system and Docker installation meet the requirements for Python 3.12, such as Docker version 20.10.10 or higher.
- Verify the SAM CLI version is recent enough to support Python 3.12.
- Check if installing dependencies directly with
pip install -r requirements.txt
inside a Docker container with the Python 3.12 image has the same issue. - Try simplifying the template to use a minimal "Hello World" type function without external dependencies at first.
- Consider creating a Lambda layer with your dependencies instead of including them directly in the deployment package.
The Python 3.12 runtime made some changes to return Unicode strings directly instead of escaped sequences, which may cause compatibility issues if other components expect the previous behavior. Updating dependent systems, packages or code to support the new return format could help resolve the problem.
0
I don't know if it will help, but I used the sam build command in the folder created after sam init and received the above error. My solution is I deleted the contents in the requirements.txt file and built it. It ran without problem.
已回答 1 个月前
相关内容
- AWS 官方已更新 3 年前
- AWS 官方已更新 3 年前
- AWS 官方已更新 4 年前
--force-rm doesn't seem to exist : https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-build.html And sam build --no-cached does not work, same error.
Could you please try the following steps and then review the logs generated during the build process?