Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: SAM build failed #932

Closed
abdulfousan opened this issue Apr 29, 2019 · 1 comment
Closed

Windows: SAM build failed #932

abdulfousan opened this issue Apr 29, 2019 · 1 comment

Comments

@abdulfousan
Copy link

Describe the bug
When i try to run lambda local using intellij IDE. Sam started to build project from temp location where it copies the files and folder from source (using codeUri) to temp location and parsing all the files then start to executing invoke command. After that build get failed and showing permission denied error.

To reproduce

  1. After configure for lambda function with required options
  2. Click run icon

Expected behavior
Build won't get failed.

Screenshots
1

Your Environment

  • OS: Windows
  • JetBrains' Product:Intelli Idea Community Edition
  • JetBrains' Product Version: 2018.3.4
  • Toolkit Version: 1.2
  • SAM CLI Version: 0.14.2
  • JVM/Python Version: 3.5.2

Additional context
My project contains source control files (.git files). SAM build failed because it not able read git objects. If there any way to SKIP the folder while build.

Also face this error sometimes,
Error: JavaMavenWorkflow:MavenBuild - 'ascii' codec can't encode character u'\xbb' in position 1266705: ordinal not in range(128)

Error log:
C:\Python37-32\Scripts\sam.exe build --template C:\Users\test-user\AppData\Local\Temp\template1.yaml --build-dir C:\Users\sys-user\AppData\Local\Temp\lambdaBuild1
2019-04-29 20:26:20 Building resource 'Function'
2019-04-29 20:26:21 Running JavaMavenWorkflow:CopySource
2019-04-29 20:26:34 Running JavaMavenWorkflow:MavenBuild
2019-04-29 20:29:01 Running JavaMavenWorkflow:MavenCopyDependency
2019-04-29 20:29:20 Running JavaMavenWorkflow:MavenCopyArtifacts
Traceback (most recent call last):
File "c:\python37-32\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "c:\python37-32\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Python37-32\Scripts\sam.exe_main
.py", line 9, in
File "c:\python37-32\lib\site-packages\click\core.py", line 722, in call
return self.main(*args, **kwargs)
File "c:\python37-32\lib\site-packages\click\core.py", line 697, in main
rv = self.invoke(ctx)
File "c:\python37-32\lib\site-packages\click\core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\python37-32\lib\site-packages\click\core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\python37-32\lib\site-packages\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "c:\python37-32\lib\site-packages\click\decorators.py", line 64, in new_func
return ctx.invoke(f, obj, args[1:], *kwargs)
File "c:\python37-32\lib\site-packages\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "C:\Users\sys-user\AppData\Roaming\Python\Python37\site-packages\samcli\commands\build\command.py", line 95, in cli
skip_pull_image, parameter_overrides) # pragma: no cover
File "C:\Users\sys-user\AppData\Roaming\Python\Python37\site-packages\samcli\commands\build\command.py", line 133, in do_cli
artifacts = builder.build()
File "C:\Users\sys-user\AppData\Roaming\Python\Python37\site-packages\samcli\lib\build\app_builder.py", line 99, in build
lambda_function.runtime)
File "C:\Users\sys-user\AppData\Roaming\Python\Python37\site-packages\samcli\lib\build\app_builder.py", line 190, in _build_function
runtime)
File "c:\python37-32\lib\contextlib.py", line 119, in exit
next(self.gen)
File "C:\Users\sys-user\AppData\Roaming\Python\Python37\site-packages\samcli\lib\utils\osutils.py", line 40, in mkdir_temp
shutil.rmtree(temp_dir)
File "c:\python37-32\lib\shutil.py", line 513, in rmtree
return _rmtree_unsafe(path, onerror)
File "c:\python37-32\lib\shutil.py", line 392, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
File "c:\python37-32\lib\shutil.py", line 392, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
File "c:\python37-32\lib\shutil.py", line 392, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
File "c:\python37-32\lib\shutil.py", line 397, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File "c:\python37-32\lib\shutil.py", line 395, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'C:\Users\test-user\AppData\Local\Temp\tmpcok3g9n9\.git\objects\01\211802753b064db7468a67a23241b18c59db64'

@abrooksv
Copy link
Contributor

This would need to be fixed in SAM CLI itself. Copied your issue to aws/aws-sam-cli#1160

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants