我正在通过 IntelliJ 的 AWS 工具包将 Spring 应用程序上传到 AWS 上的 Lambda 函数,但是当将代码上传到 S3 存储桶时,它运行 sam build 并产生以下错误:
2019-04-23 19:44:41 Building resource 'Function'
2019-04-23 19:44:41 Running JavaMavenWorkflow:CopySource
2019-04-23 19:44:48 Running JavaMavenWorkflow:MavenBuild
Traceback (most recent call last):
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\aws_lambda_builders\workflow.py", line 248, in run
action.execute()
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\aws_lambda_builders\workflows\java_maven\actions.py", line 40, in execute
self.subprocess_maven.build(self.scratch_dir)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\aws_lambda_builders\workflows\java_maven\maven.py", line 32, in build
LOG.debug("Maven logs: %s", stdout.decode('utf8').strip())
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbb in position 31648: invalid start byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\build\app_builder.py", line 220, in _build_function_in_process
mode=self._mode)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\aws_lambda_builders\builder.py", line 115, in build
return workflow.run()
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\aws_lambda_builders\workflow.py", line 65, in wrapper
func(self, *args, **kwargs)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\aws_lambda_builders\workflow.py", line 263, in run
reason=str(ex))
aws_lambda_builders.exceptions.WorkflowUnknownError: JavaMavenWorkflow:MavenBuild - 'utf-8' codec can't decode byte 0xbb in position 31648: invalid start byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\utils\osutils.py", line 36, in mkdir_temp
yield temp_dir
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\build\app_builder.py", line 199, in _build_function
runtime)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\build\app_builder.py", line 222, in _build_function_in_process
raise BuildError(str(ex))
samcli.lib.build.app_builder.BuildError: JavaMavenWorkflow:MavenBuild - 'utf-8' codec can't decode byte 0xbb in position 31648: invalid start byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "runpy.py", line 193, in _run_module_as_main
File "runpy.py", line 85, in _run_code
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\__main__.py", line 12, in <module>
cli(prog_name="sam")
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 697, in main
rv = self.invoke(ctx)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args[1:], **kwargs)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\commands\build\command.py", line 100, in cli
skip_pull_image, parameter_overrides, mode) # pragma: no cover
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\commands\build\command.py", line 141, in do_cli
artifacts = builder.build()
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\build\app_builder.py", line 108, in build
lambda_function.runtime)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\build\app_builder.py", line 199, in _build_function
runtime)
File "contextlib.py", line 99, in __exit__
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\utils\osutils.py", line 40, in mkdir_temp
shutil.rmtree(temp_dir)
File "shutil.py", line 494, in rmtree
File "shutil.py", line 384, in _rmtree_unsafe
File "shutil.py", line 384, in _rmtree_unsafe
File "shutil.py", line 384, in _rmtree_unsafe
File "shutil.py", line 389, in _rmtree_unsafe
File "shutil.py", line 387, in _rmtree_unsafe
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\MYUSR~1.T-C\\AppData\\Local\\Temp\\tmprnqr_8tf\\.git\\objects\\00\\1d37e180fc93c0908cd70014bc75d1b2ae8bfd'
不得不更改函数的区域并更新 IDE,但不知何故它停止了工作。
Java 8
AWS Toolkit v1.2
sam >> SAM CLI
0.15.0 aws >> aws-cli/1.16.144 Python/3.6.0 Windows/10 botocore/1.12.134