简体   繁体   English

执行命令时出错:sam build --use-container --template ${SAM_TEMPLATE}。 原因:退出状态1

[英]Error while executing command: sam build --use-container --template ${SAM_TEMPLATE}. Reason: exit status 1

I was trying to run sam build --use-container --template ${SAM_TEMPLATE} but it failed and showed Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: sam build --use-container --template ${SAM_TEMPLATE}.我试图运行 sam build --use-container --template ${SAM_TEMPLATE} 但它失败并显示阶段上下文状态代码:COMMAND_EXECUTION_ERROR 消息:执行命令时出错:sam build --use-container --template ${SAM_TEMPLATE }. Reason: exit status 1原因:退出状态1

Observed result:观察结果:

247 | \[Container\] 2023/01/02 09:00:13 Phase context status code: Message:
248 | \[Container\] 2023/01/02 09:00:13 Entering phase PRE_BUILD
249 | \[Container\] 2023/01/02 09:00:13 Phase complete: PRE_BUILD State: SUCCEEDED
250 | \[Container\] 2023/01/02 09:00:13 Phase context status code: Message:
251 | \[Container\] 2023/01/02 09:00:13 Entering phase BUILD
252 | \[Container\] 2023/01/02 09:00:13 Running command sam build --use-container --template ${SAM_TEMPLATE}
253 | Traceback (most recent call last):
254 | File "/root/.pyenv/versions/3.8.13/bin/sam", line 8, in
255 | sys.exit(cli())
256 | File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/click/core.py", line 1130, in call
257 | return self.main(\*args, \*kwargs)
258 | File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/click/core.py", line 1055, in main
259 | rv = self.invoke(ctx)
260 | File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/click/core.py", line 1651, in invoke
261 | cmd_name, cmd, args = self.resolve_command(ctx, args)
262 | File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/click/core.py", line 1698, in resolve_command
263 | cmd = self.get_command(ctx, cmd_name)
264 | File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/samcli/cli/command.py", line 133, in get_command
265 | mod = importlib.import_module(pkg_name)
266 | File "/root/.pyenv/versions/3.8.13/lib/python3.8/importlib/init.py", line 127, in import_module
267 | return \_bootstrap.\_gcd_import(name\[level:\], package, level)
268 | File "", line 1014, in \_gcd_import
269 | File "", line 991, in \_find_and_load
270 | File "", line 975, in \_find_and_load_unlocked
271 | File "", line 671, in \_load_unlocked
272 | File "", line 843, in exec_module
273 | File "", line 219, in \_call_with_frames_removed
274 | File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/samcli/commands/build/init.py", line 6, in
275 | from .command import cli # noqa
276 | File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/samcli/commands/build/command.py", line 12, in
277 | from samcli.commands.\_utils.options import (
278 | File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/samcli/commands/\_utils/options.py", line 21, in
279 | from samcli.commands.\_utils.template import get_template_data, TemplateNotFoundException
280 | File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/samcli/commands/\_utils/template.py", line 10, in
281 | from botocore.utils import set_value_from_jmespath
282 | File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/botocore/utils.py", line 37, in
283 | import botocore.httpsession
284 | File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/botocore/httpsession.py", line 46, in
285 | from urllib3.contrib.pyopenssl import (
286 | File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/urllib3/contrib/pyopenssl.py", line 50, in
287 | import OpenSSL.SSL
288 | File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/OpenSSL/init.py", line 8, in
289 | from OpenSSL import crypto, SSL
290 | File "/root/.pyenv/versions/3.8.13/lib/python3.8/site-packages/OpenSSL/crypto.py", line 3268, in
291 | \_lib.OpenSSL_add_all_algorithms()
292 | AttributeError: module 'lib' has no attribute 'OpenSSL_add_all_algorithms'
293 |  
294 | \[Container\] 2023/01/02 09:00:14 Command did not exit successfully sam build --use-container --template ${SAM_TEMPLATE} exit status 1
295 | \[Container\] 2023/01/02 09:00:14 Phase complete: BUILD State: FAILED
296 | \[Container\] 2023/01/02 09:00:14 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: sam build --use-container --template ${SAM_TEMPLATE}. Reason: exit status 1
297 | \[Container\] 2023/01/02 09:00:14 Entering phase POST_BUILD
298 | \[Container\] 2023/01/02 09:00:14 Phase complete: POST_BUILD State: SUCCEEDED
299 | \[Container\] 2023/01/02 09:00:14 Phase context status code: Message:
300 | \[Container\] 2023/01/02 09:00:14 exiting execCommands
301 | \[Container\] 2023/01/02 09:00:14 Expanding base directory path: .
302 | \[Container\] 2023/01/02 09:00:14 Assembling file list
303 | \[Container\] 2023/01/02 09:00:14 Expanding .
304 | \[Container\] 2023/01/02 09:00:14 Expanding file paths for base directory .
305 | \[Container\] 2023/01/02 09:00:14 Assembling file list
306 | \[Container\] 2023/01/02 09:00:14 Expanding packaged-test.yaml
307 | \[Container\] 2023/01/02 09:00:14 Skipping invalid file path packaged-test.yaml
308 | \[Container\] 2023/01/02 09:00:14 Expanding assume-role.sh
309 | \[Container\] 2023/01/02 09:00:14 Expanding pipeline/
310 | \[Container\] 2023/01/02 09:00:14 Found 8 file(s)
311 | \[Container\] 2023/01/02 09:00:14 Phase complete: UPLOAD_ARTIFACTS State: SUCCEEDED
312 | \[Container\] 2023/01/02 09:00:14 Phase context status code: Message:

Expected Result:- Build successful

I was getting same error while running codepipeline in aws, following worked for me.在 aws 中运行 codepipeline 时我遇到了同样的错误,以下对我有用。

- pip install --upgrade pyOpenSSL

Hope it will help someone too.希望它也会对某人有所帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 AWS SAM 模板中获取 Fn::GetAtt 错误 - Getting Fn::GetAtt error in the AWS SAM template AWS SAM:我们可以在 aws sam 模板中使用已经存在的 api 吗? - AWS SAM: can we use a already existing api in aws sam template? AWS SAM/CloudFormation 模板 Lambda 删除保护 - AWS SAM/CloudFormation Template Lambda Delete Protection 如何在 SAM 模板中从 Lambda 访问 DynamoDB 表? - How to access DynamoDB table from Lambda in a SAM Template? 如何在 AWS SAM 模板中添加未经身份验证的路由 - How to add non authenticated routes in AWS SAM template 是否可以覆盖 AWS SAM 策略模板占位符变量 - Is it possible to override AWS SAM policy template placeholder variables 如何将 Sam 与 lambda 和发电机一起使用并放大? - How to use Sam with lambda and dynamo and amplify? 使用 sam init 部署 AWS Lambda“Hello World”,sam build sam deploy defaults 失败,无法为 sam-app 创建变更集 - Deploying AWS Lambda "Hello World" using sam init, sam build sam deploy defaults fails with Failed to create changeset for sam-app 如果它在 API 网关 DefinitionBody 中作为响应示例,我如何让空值传入 sam 模板 - How can I let a null values pass in a sam template if it is in an API Gateway DefinitionBody as a response example 在定义单个 AWS::Serverless::Function 的 SAM 模板中指定多个 API 阶段和 Lambda 别名 - Specify multiple API stages and Lambda Aliases in SAM template defining a single AWS::Serverless::Function
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM