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

sam build error: The process cannot access the file because it is being used by another process #4595

Open
betimer opened this issue Jan 20, 2023 · 9 comments
Labels

Comments

@betimer
Copy link

betimer commented Jan 20, 2023

Describe the bug

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 
'C:\\Users\\betim\\AppData\\Local\\Temp\\tmpr4kzrh76'

To reproduce

  1. sam init
  2. just choose hello world (type script)
  3. rename the folder name (also update the path in template.yaml
  4. sam build

Expected behavior
Success without any error (I have also tried to manually remove the temp file, but it turns out the error is consistent with each time it also generate again, so the root cause will be from sam build itself, and it generate the temp file

Screenshots
image
Your Environment

  • OS: Windwos 11 64bit
@betimer betimer added the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label Jan 20, 2023
@betimer betimer changed the title sam build - The process cannot access the file because it is being used by another process sam build error: The process cannot access the file because it is being used by another process Jan 20, 2023
@qingchm qingchm added platform/windows area/build sam build command and removed stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Jan 24, 2023
@qingchm
Copy link
Contributor

qingchm commented Jan 25, 2023

Hi @betimer thanks for reaching out! Trying to understand the cause here, can I confirm with you that if you do not operate step 3 to rename, this issue does not occur?

@betimer
Copy link
Author

betimer commented Jan 25, 2023

Hi @qingchm
I tried again without renaming the folder.
And I can see that just after npm install @prisma/client It begins to have this issue. Is that sam having issue with some packages?

@qingchm
Copy link
Contributor

qingchm commented Jan 25, 2023

@betimer Thanks for the response, seems like this is an issue that occurred during the build process when we download dependencies, would you mind running the command with --debug flag on and paste in more detailed logs here for me to investigate? That would be greatly appreciated

@betimer
Copy link
Author

betimer commented Jan 25, 2023

@qingchm

PS C:\xsrc\test\helper-funcs\lw-data-puller> sam build --debug
2023-01-26 10:03:15,144 | Config file location: C:\xsrc\test\helper-funcs\lw-data-puller\samconfig.toml
2023-01-26 10:03:15,146 | Config file 'C:\xsrc\test\helper-funcs\lw-data-puller\samconfig.toml' does not exist
2023-01-26 10:03:15,151 | Using SAM Template at C:\xsrc\test\helper-funcs\lw-data-puller\template.yaml
2023-01-26 10:03:15,398 | Using config file: samconfig.toml, config environment: default
2023-01-26 10:03:15,398 | Expand command line arguments to:
2023-01-26 10:03:15,398 | --template_file=C:\xsrc\test\helper-funcs\lw-data-puller\template.yaml --build_dir=.aws-sam\build --cache_dir=.aws-sam\cache 
2023-01-26 10:03:16,616 | 'build' command is called
2023-01-26 10:03:16,620 | No Parameters detected in the template
2023-01-26 10:03:16,643 | There is no customer defined id or cdk path defined for resource HelloWorldFunction, so we will use the resource logical id as the resource id
2023-01-26 10:03:16,643 | There is no customer defined id or cdk path defined for resource ApplicationResourceGroup, so we will use the resource logical id as the resource id
2023-01-26 10:03:16,643 | There is no customer defined id or cdk path defined for resource ApplicationInsightsMonitoring, so we will use the resource logical id as the resource id
2023-01-26 10:03:16,643 | There is no customer defined id or cdk path defined for resource ServerlessRestApi, so we will use the resource logical id as the resource id
2023-01-26 10:03:16,644 | 0 stacks found in the template
2023-01-26 10:03:16,644 | No Parameters detected in the template
2023-01-26 10:03:16,655 | There is no customer defined id or cdk path defined for resource HelloWorldFunction, so we will use the resource logical id as the resource id
2023-01-26 10:03:16,656 | There is no customer defined id or cdk path defined for resource ApplicationResourceGroup, so we will use the resource logical id as the resource id
2023-01-26 10:03:16,656 | There is no customer defined id or cdk path defined for resource ApplicationInsightsMonitoring, so we will use the resource logical id as the resource id
2023-01-26 10:03:16,657 | There is no customer defined id or cdk path defined for resource ServerlessRestApi, so we will use the resource logical id as the resource id
2023-01-26 10:03:16,658 | 4 resources found in the stack
2023-01-26 10:03:16,658 | Found Serverless function with name='HelloWorldFunction' and CodeUri='hello-world/'
2023-01-26 10:03:16,659 | --base-dir is not presented, adjusting uri hello-world/ relative to C:\xsrc\test\helper-funcs\lw-data-puller\template.yaml
2023-01-26 10:03:16,672 | 4 resources found in the stack 
2023-01-26 10:03:16,673 | Found Serverless function with name='HelloWorldFunction' and CodeUri='hello-world/'
2023-01-26 10:03:16,673 | Found Serverless function with name='HelloWorldFunction' and CodeUri='hello-world/'
2023-01-26 10:03:16,674 | --base-dir is not presented, adjusting uri hello-world/ relative to C:\xsrc\test\helper-funcs\lw-data-puller\template.yaml
2023-01-26 10:03:16,675 | Instantiating build definitions
2023-01-26 10:03:16,694 | Same function build definition found, adding function (Previous: BuildDefinition(nodejs18.x, C:\xsrc\test\helper-funcs\lw-data-puller\hello-world, Zip, , 87d9d1f5-8d25-44aa-b275-f11612b2b0e2, {'BuildMethod': 'esbuild', 'BuildProperties': {'Minify': True, 'Target': 'es2020', 'Sourcemap': True, 'EntryPoints': ['app.ts']}}, {}, x86_64, []), Current: BuildDefinition(nodejs18.x, C:\xsrc\test\helper-funcs\lw-data-puller\hello-world, Zip, , 22c405d9-bec9-4a98-b241-05682c24d868, {'BuildMethod': 'esbuild', 'BuildProperties': {'Minify': True, 'Target': 'es2020', 'Sourcemap': True, 'EntryPoints': ['app.ts']}}, {}, x86_64, []), Function: Function(function_id='HelloWorldFunction', name='HelloWorldFunction', functionname='HelloWorldFunction', runtime='nodejs18.x', memory=None, timeout=3, handler='app.lambdaHandler', imageuri=None, packagetype='Zip', imageconfig=None, codeuri='C:\\xsrc\\test\\helper-funcs\\lw-data-puller\\hello-world', environment=None, rolearn=None, layers=[], events={'HelloWorld': {'Type': 'Api', 'Properties': {'Path': '/hello', 'Method': 'get', 'RestApiId': 'ServerlessRestApi'}}}, metadata={'BuildMethod': 'esbuild', 'BuildProperties': {'Minify': True, 'Target': 'es2020', 'Sourcemap': True, 'EntryPoints': ['app.ts']}, 'SamResourceId': 'HelloWorldFunction'}, inlinecode=None, codesign_config_arn=None, architectures=['x86_64'], function_url_config=None, stack_path='', runtime_management_config=None))
2023-01-26 10:03:16,696 | Building codeuri: C:\xsrc\test\helper-funcs\lw-data-puller\hello-world runtime: nodejs18.x metadata: {'BuildMethod': 'esbuild', 'BuildProperties': {'Minify': True, 'Target': 'es2020', 'Sourcemap': True, 'EntryPoints': ['app.ts']}} architecture: x86_64 functions: HelloWorldFunction
2023-01-26 10:03:16,697 | Building to following folder C:\xsrc\test\helper-funcs\lw-data-puller\.aws-sam\build\HelloWorldFunction
2023-01-26 10:03:16,699 | Loading workflow module 'aws_lambda_builders.workflows'
2023-01-26 10:03:16,718 | Registering workflow 'PythonPipBuilder' with capability 'Capability(language='python', dependency_manager='pip', application_framework=None)'
2023-01-26 10:03:16,730 | Registering workflow 'NodejsNpmBuilder' with capability 'Capability(language='nodejs', dependency_manager='npm', application_framework=None)'
2023-01-26 10:03:16,736 | Registering workflow 'RubyBundlerBuilder' with capability 'Capability(language='ruby', dependency_manager='bundler', application_framework=None)'
2023-01-26 10:03:16,749 | Registering workflow 'GoModulesBuilder' with capability 'Capability(language='go', dependency_manager='modules', application_framework=None)'
2023-01-26 10:03:16,767 | Registering workflow 'JavaGradleWorkflow' with capability 'Capability(language='java', dependency_manager='gradle', application_framework=None)'
2023-01-26 10:03:16,783 | Registering workflow 'JavaMavenWorkflow' with capability 'Capability(language='java', dependency_manager='maven', application_framework=None)'
2023-01-26 10:03:16,797 | Registering workflow 'DotnetCliPackageBuilder' with capability 'Capability(language='dotnet', dependency_manager='cli-package', application_framework=None)'
2023-01-26 10:03:16,812 | Registering workflow 'CustomMakeBuilder' with capability 'Capability(language='provided', dependency_manager=None, application_framework=None)'
2023-01-26 10:03:16,824 | Registering workflow 'NodejsNpmEsbuildBuilder' with capability 'Capability(language='nodejs', dependency_manager='npm-esbuild', application_framework=None)'
2023-01-26 10:03:16,827 | Found workflow 'NodejsNpmEsbuildBuilder' to support capabilities 'Capability(language='nodejs', dependency_manager='npm-esbuild', application_framework=None)'
2023-01-26 10:03:16,828 | executing NPM: ['npm.cmd', 'root']
2023-01-26 10:03:17,709 | Lambda Builders found the following esbuild properties:
{"minify": true, "target": "es2020", "sourcemap": true, "entry_points": ["app.ts"]}
2023-01-26 10:03:17,715 | Running workflow 'NodejsNpmEsbuildBuilder'
2023-01-26 10:03:17,715 | Running NodejsNpmEsbuildBuilder:CopySource
2023-01-26 10:03:17,716 | Copying source file (C:\xsrc\test\helper-funcs\lw-data-puller\hello-world\.env) to destination (C:\Users\betim\AppData\Local\Temp\tmp0dxp9sgw\.env)
2023-01-26 10:03:17,718 | Copying source file (C:\xsrc\test\helper-funcs\lw-data-puller\hello-world\.eslintignore) to destination (C:\Users\betim\AppData\Local\Temp\tmp0dxp9sgw\.eslintignore)
2023-01-26 10:03:17,719 | Copying source file (C:\xsrc\test\helper-funcs\lw-data-puller\hello-world\.eslintrc.js) to destination (C:\Users\betim\AppData\Local\Temp\tmp0dxp9sgw\.eslintrc.js)
2023-01-26 10:03:17,721 | Copying source file (C:\xsrc\test\helper-funcs\lw-data-puller\hello-world\.gitignore) to destination (C:\Users\betim\AppData\Local\Temp\tmp0dxp9sgw\.gitignore)
2023-01-26 10:03:17,723 | Copying source file (C:\xsrc\test\helper-funcs\lw-data-puller\hello-world\.npmignore) to destination (C:\Users\betim\AppData\Local\Temp\tmp0dxp9sgw\.npmignore)
2023-01-26 10:03:17,724 | Copying source file (C:\xsrc\test\helper-funcs\lw-data-puller\hello-world\.prettierrc.js) to destination (C:\Users\betim\AppData\Local\Temp\tmp0dxp9sgw\.prettierrc.js)
2023-01-26 10:03:17,725 | Copying source file (C:\xsrc\test\helper-funcs\lw-data-puller\hello-world\app.ts) to destination (C:\Users\betim\AppData\Local\Temp\tmp0dxp9sgw\app.ts)
2023-01-26 10:03:17,727 | Copying source file (C:\xsrc\test\helper-funcs\lw-data-puller\hello-world\jest.config.ts) to destination (C:\Users\betim\AppData\Local\Temp\tmp0dxp9sgw\jest.config.ts)
2023-01-26 10:03:17,732 | File (node_modules) is in ignored set, skipping it
2023-01-26 10:03:17,732 | Copying source file (C:\xsrc\test\helper-funcs\lw-data-puller\hello-world\package-lock.json) to destination (C:\Users\betim\AppData\Local\Temp\tmp0dxp9sgw\package-lock.json)
2023-01-26 10:03:17,734 | Copying source file (C:\xsrc\test\helper-funcs\lw-data-puller\hello-world\package.json) to destination (C:\Users\betim\AppData\Local\Temp\tmp0dxp9sgw\package.json)
2023-01-26 10:03:17,735 | Creating target folders at C:\Users\betim\AppData\Local\Temp\tmp0dxp9sgw\prisma
2023-01-26 10:03:17,735 | Copying directory metadata from source (C:\xsrc\test\helper-funcs\lw-data-puller\hello-world\prisma) to destination (C:\Users\betim\AppData\Local\Temp\tmp0dxp9sgw\prisma)
2023-01-26 10:03:17,736 | Copying source file (C:\xsrc\test\helper-funcs\lw-data-puller\hello-world\prisma\schema.prisma) to destination (C:\Users\betim\AppData\Local\Temp\tmp0dxp9sgw\prisma\schema.prisma)
2023-01-26 10:03:17,738 | Creating target folders at C:\Users\betim\AppData\Local\Temp\tmp0dxp9sgw\tests
2023-01-26 10:03:17,738 | Copying directory metadata from source (C:\xsrc\test\helper-funcs\lw-data-puller\hello-world\tests) to destination (C:\Users\betim\AppData\Local\Temp\tmp0dxp9sgw\tests)
2023-01-26 10:03:17,739 | Creating target folders at C:\Users\betim\AppData\Local\Temp\tmp0dxp9sgw\tests\unit
2023-01-26 10:03:17,739 | Copying directory metadata from source (C:\xsrc\test\helper-funcs\lw-data-puller\hello-world\tests\unit) to destination (C:\Users\betim\AppData\Local\Temp\tmp0dxp9sgw\tests\unit)
2023-01-26 10:03:17,740 | Copying source file (C:\xsrc\test\helper-funcs\lw-data-puller\hello-world\tests\unit\test-handler.test.ts) to destination (C:\Users\betim\AppData\Local\Temp\tmp0dxp9sgw\tests\unit\test-handler.test.ts)
2023-01-26 10:03:17,741 | Copying source file (C:\xsrc\test\helper-funcs\lw-data-puller\hello-world\tsconfig.json) to destination (C:\Users\betim\AppData\Local\Temp\tmp0dxp9sgw\tsconfig.json)
2023-01-26 10:03:17,742 | NodejsNpmEsbuildBuilder:CopySource succeeded
2023-01-26 10:03:17,742 | Running NodejsNpmEsbuildBuilder:NpmInstall
2023-01-26 10:03:17,743 | NODEJS installing in: C:\Users\betim\AppData\Local\Temp\tmp0dxp9sgw
2023-01-26 10:03:17,743 | executing NPM: ['npm.cmd', 'install', '-q', '--no-audit', '--no-save', '--unsafe-perm', '--production']
2023-01-26 10:03:27,195 | NodejsNpmEsbuildBuilder:NpmInstall succeeded
2023-01-26 10:03:27,195 | Running NodejsNpmEsbuildBuilder:EsbuildBundle
2023-01-26 10:03:27,195 | NODEJS building ['C:\\Users\\betim\\AppData\\Local\\Temp\\tmp0dxp9sgw\\app.ts'] using esbuild to C:\xsrc\test\helper-funcs\lw-data-puller\.aws-sam\build\HelloWorldFunction
2023-01-26 10:03:27,195 | Using the following default args: ['--bundle', '--platform=node', '--outdir=C:\\xsrc\\test\\helper-funcs\\lw-data-puller\\.aws-sam\\build\\HelloWorldFunction', '--format=cjs']
2023-01-26 10:03:27,196 | Found the following args in the config: ['--minify', '--sourcemap', '--target=es2020']
2023-01-26 10:03:27,196 | checking for esbuild in: ['C:\\Users\\betim\\node_modules\\.bin']
2023-01-26 10:03:27,199 | potential esbuild binaries: ['C:\\Users\\betim\\AppData\\Roaming\\npm\\esbuild.CMD']
2023-01-26 10:03:27,200 | executing Esbuild: ['C:\\Users\\betim\\AppData\\Roaming\\npm\\esbuild.CMD', 'app.ts', '--bundle', '--platform=node', '--outdir=C:\\xsrc\\test\\helper-funcs\\lw-data-puller\\.aws-sam\\build\\HelloWorldFunction', '--format=cjs', '--minify', '--sourcemap', '--target=es2020']
2023-01-26 10:03:27,349 | NodejsNpmEsbuildBuilder:EsbuildBundle succeeded
2023-01-26 10:03:27,410 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2023-01-26 10:03:27,541 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2023-01-26 10:03:27,541 | Sending Telemetry: {'metrics': [{'commandRun': {'requestId': '02267ee3-dd62-41cd-8c85-cf89d79190e5', 'installationId': 'cd053703-3a7b-4747-810c-de2bd43bd6bb', 'sessionId': '0e482360-8ad5-4778-9fc9-5591600571d0', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.8.8', 'samcliVersion': '1.71.0', 'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam build', 'metricSpecificAttributes': {'projectType': 'CFN', 'gitOrigin': 'f673268b4bb71792b05f3651d3a8ffabdfe6edb887c18ce348111085c33ecb72', 'projectName': '561615620ad6611c3163c312fb68c0a47e0b497750ff76f98bce9d7b98a6b2d0', 'initialCommit': '574dd9a3b3632e5a39b8cb7d4535c430c570677b592322fb4920f94e113191ba'}, 'duration': 12012, 'exitReason': 'PermissionError', 'exitCode': 255}}]}
2023-01-26 10:03:27,541 | Unable to find Click Context for getting session_id.
2023-01-26 10:03:27,543 | Sending Telemetry: {'metrics': [{'events': {'requestId': 'deb4bba8-70e4-4f47-a5ed-f741f95560a2', 'installationId': 'cd053703-3a7b-4747-810c-de2bd43bd6bb', 'sessionId': '0e482360-8ad5-4778-9fc9-5591600571d0', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.8.8', 'samcliVersion': '1.71.0', 'metricSpecificAttributes': {'events': [{'event_name': 'BuildWorkflowUsed', 'event_value': 'nodejs-npm-esbuild', 'thread_id': 17724, 'time_stamp': '2023-01-25 23:03:16.698'}]}}}]}
2023-01-26 10:03:28,352 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)
2023-01-26 10:03:28,368 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)

Error: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\betim\\AppData\\Local\\Temp\\tmp0dxp9sgw'
Traceback:
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 1657, 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 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\telemetry\metric.py", line 183, in wrapped
    raise exception  # pylint: disable=raising-bad-type
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\telemetry\metric.py", line 150, in wrapped
    return_value = func(*args, **kwargs)
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\utils\version_checker.py", line 41, in wrapped
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\commands\build\build_context.py", line 261, in run
    build_result = builder.build()
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\build\app_builder.py", line 214, in build
    return ApplicationBuildResult(build_graph, build_strategy.build())
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\build\build_strategy.py", line 80, in build
    result.update(self._build_functions(self._build_graph))
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\build\build_strategy.py", line 90, in _build_functions     
    function_build_results.update(self.build_single_function_definition(build_definition))
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\build\build_strategy.py", line 163, in build_single_function_definition
    result = self._build_function(
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\build\app_builder.py", line 698, in _build_function        
    return self._build_function_in_process(
  File "contextlib.py", line 120, in __exit__
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\utils\osutils.py", line 55, in mkdir_temp
    shutil.rmtree(temp_dir)  File "shutil.py", line 740, in rmtree
  File "shutil.py", line 622, in _rmtree_unsafe
  File "shutil.py", line 620, in _rmtree_unsafe

An unexpected error was encountered while executing "sam build".
Search for an existing issue:
https://github.com/aws/aws-sam-cli/issues?q=is%3Aissue+is%3Aopen+Bug%3A%20sam%20build%20-%20PermissionError
Or create a bug report:
https://github.com/aws/aws-sam-cli/issues/new?template=Bug_report.md&title=Bug%3A%20sam%20build%20-%20PermissionError
PS C:\xsrc\test\helper-funcs\lw-data-puller>

@ninmonkey
Copy link

image

I get the same error as OP, but only 10% of the time it will happen.
When it does happen, if I re-run the same sam build and without any code being changed it works.

sam build
sam build
sam deploy

I'm wondering if there's a really brief time a file is read by an editor or git or something, where a single retry or wait would fix.
I will try and see if I get capture one with --debug

@ninmonkey
Copy link

ninmonkey commented Jul 19, 2023

Initial thoughts on conflicts

At first I wondered if somehow aws-sam-cli has an issue if the cached dir .aws-sam is read by vs code or github desktop or a terminal, etc.

But that didn't seem to make sense, because

  • re-run using the exact same state, works 85% of the time
  • I don't have to quit vs code, or github desktop, or terminal and it worked
  • the exception seemed like it might be on the docker portion rather than the source path

Vs Code was okay

I opened the directory ...\demo-runtime-layer-function\.aws-sam directly as a new Vs Code instance. Hoping it would cause it to lock up while it's open. but sam build works.

I can collect other diagnostics if I know what to do. I wasn't sure if the true cause is actually aws-sam-cli or if the message was a herring.

Updated log with --debug

Here's the short version

CustomMakeBuilder:MakeBuild succeeded
2023-07-19 11:27:03,526 | Failed to get the logs from the container
Traceback (most recent call last):
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\local\docker\container.py", line 433, in _write_container_output
Found workflow 'CustomMakeBuilder' to support capabilities 'Capability(language='provided',
dependency_manager=None, application_framework=None)'
Running workflow 'CustomMakeBuilder'
Running CustomMakeBuilder:CopySource
Copying source file (/tmp/samcli/source/.gitignore) to destination (/tmp/samcli/scratch/.gitignore)
...
Copying source file (/tmp/samcli/source/ImportExcel/7.8.4/SUMMARY.md) to destination (/tmp/samcli/scratch/ImportExcel/7.8.4/SUMMARY.md)
Copying source file (/tmp/samcli/source/Makefile) to destination (/tmp/samcli/scratch/Makefile)
CustomMakeBuilder:CopySource succeeded
Running CustomMakeBuilder:MakeBuild
Current Artifacts Directory : /tmp/samcli/artifacts
executing Make: ['make', '--makefile', '/tmp/samcli/source/Makefile', 'build-AbcDemoPowerShellFunction']
cp -R . /tmp/samcli/artifacts
rm /tmp/samcli/artifacts/Makefile
CustomMakeBuilder:MakeBuild succeeded
2023-07-19 11:27:03,526 | Failed to get the logs from the container
Traceback (most recent call last):
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\local\docker\container.py", line 433, in _write_container_output
    for stdout_data, stderr_data in output_itr:
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\types\daemon.py", line 32, in __next__
    return next(self._stream)
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\api\client.py", line 406, in <genexpr>
    gen = (demux_adaptor(*frame) for frame in gen)
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\utils\socket.py", line 94, in frames_iter_no_tty
    (stream, n) = next_frame_header(socket)
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\utils\socket.py", line 66, in next_frame_header
    data = read_exactly(socket, 8)
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\utils\socket.py", line 51, in read_exactly
    next_data = read(socket, n - len(data))
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\utils\socket.py", line 35, in read
    return socket.recv(n)
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\transport\npipesocket.py", line 23, in wrapped
    return f(self, *args, **kwargs)
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\transport\npipesocket.py", line 117, in recv
    err, data = win32file.ReadFile(self._handle, bufsize)

Long Version

full log +200 more lines

VERBOSE: Sam args: => build --use-container --parallel --cached --skip-pull-image --debug
2023-07-19 11:26:48,254 | Config file location: G:\user\demo-runtime-layer-function\samconfig.toml
2023-07-19 11:26:48,254 | Loading configuration values from [default.['build'].parameters] (env.command_name.section) in config file at 'G:\user\demo-runtime-layer-function\samconfig.toml'...
2023-07-19 11:26:48,258 | Configuration values successfully loaded.
2023-07-19 11:26:48,258 | Configuration values are: {}
2023-07-19 11:26:48,272 | Using SAM Template at G:\user\demo-runtime-layer-function\template.yml
2023-07-19 11:26:48,299 | Using config file: samconfig.toml, config environment: default
2023-07-19 11:26:48,300 | Expand command line arguments to:
2023-07-19 11:26:48,300 | --template_file=G:\user\demo-runtime-layer-function\template.yml --use_container --parallel --cached --skip_pull_image --mount_with=READ --build_dir=.aws-sam\build --cache_dir=.aws-sam\cache
2023-07-19 11:26:49,354 | 'build' command is called
2023-07-19 11:26:49,355 | Starting Build use cache
2023-07-19 11:26:49,355 | Starting Build inside a container
2023-07-19 11:26:49,374 | No Parameters detected in the template
2023-07-19 11:26:49,408 | There is no customer defined id or cdk path defined for resource AbcDemoPowerShellFunction, so we will use the resource logical id as the resource id
    ...

2023-07-19 11:26:49,410 | 0 stacks found in the template
2023-07-19 11:26:49,411 | No Parameters detected in the template
2023-07-19 11:26:49,428 | There is no customer defined id or cdk path defined for resource AbcDemoPowerShellFunction, so we will use the resource logical id as the resource id
...
2023-07-19 11:26:49,431 | 5 resources found in the stack
2023-07-19 11:26:49,431 | --base-dir is not presented, adjusting uri ../../awsAbc-powershell-runtime/source relative to G:\user\demo-runtime-layer-function\template.yml
2023-07-19 11:26:49,432 | --base-dir is not presented, adjusting uri H:/Abclayers/aws_email relative to G:\user\demo-runtime-layer-function\template.yml
2023-07-19 11:26:49,432 | Found Serverless function with name='AbcDemoPowerShellFunction' and CodeUri='function/'
2023-07-19 11:26:49,432 | --base-dir is not presented, adjusting uri function/ relative to G:\user\demo-runtime-layer-function\template.yml
2023-07-19 11:26:49,433 | --base-dir is not presented, adjusting uri ../../awsAbc-powershell-runtime/source relative to G:\user\demo-runtime-layer-function\template.yml
2023-07-19 11:26:49,434 | --base-dir is not presented, adjusting uri H:/Abclayers/aws_email relative to G:\user\demo-runtime-layer-function\template.yml
2023-07-19 11:26:49,450 | 5 resources found in the stack
2023-07-19 11:26:49,451 | Found Serverless function with name='AbcDemoPowerShellFunction' and CodeUri='function/'
2023-07-19 11:26:49,453 | Instantiating build definitions
2023-07-19 11:26:49,471 | Unique function build definition found, adding as new (Function Build Definition: BuildDefinition(provided.al2, G:\user\demo-runtime-layer-function\function, Zip, , d2d3388d-9524-43d7-b853-2d9691dacc97, {'BuildMethod': 'makefile'}, {}, x86_64, []), Function: Function(function_id='AbcDemoPowerShellFunction', name='AbcDemoPowerShellFunction', functionname='AbcDemoPowerShellFunction', runtime='provided.al2', memory=1024, timeout=320, handler='examplehandler.ps1::handler', imageuri=None, packagetype='Zip', imageconfig=None, codeuri='G:\\temp\\2023-06-06-temp-Abc\\2023.03.17-Abc\\core\\src\\pass1\\lab-lambda-runtime\\examples\\demo-runtime-layer-function\\function', environment=None, rolearn='arn:aws:iam::954746088739:role/jumpcloud-lambda-executor', layers=[<samcli.lib.providers.provider.LayerVersion object at 0x0000011EE3B08B20>, <samcli.lib.providers.provider.LayerVersion object at 0x0000011EE3B08F10>], events=None, metadata={'BuildMethod': 'makefile', 'SamResourceId': 'AbcDemoPowerShellFunction'}, inlinecode=None, codesign_config_arn=None, architectures=None, function_url_config=None, stack_path='', runtime_management_config=None))
2023-07-19 11:26:49,471 | Unique function build definition found, adding as new (
    Function Build Definition:
        BuildDefinition(
        provided.al2,
        G:\user\demo-runtime-layer-function\function,
        Zip, , d2d3388d-9524-43d7-b853-2d9691dacc97, {'BuildMethod': 'makefile'}, {}, x86_64, []),
    Function: Function(
        function_id='AbcDemoPowerShellFunction', name='AbcDemoPowerShellFunction',
        functionname='AbcDemoPowerShellFunction', runtime='provided.al2', memory=1024, timeout=320,
        handler='examplehandler.ps1::handler', imageuri=None, packagetype='Zip',
        imageconfig=None, codeuri='G:\\...\\demo-runtime-layer-function\\function',
        environment=None, rolearn='arn:aws:iam::...role',
        layers=[    <samcli.lib.providers.provider.LayerVersion object at 0x0000011EE3B08B20>,
                    <samcli.lib.providers.provider.LayerVersion object at 0x0000011EE3B08F10>],
        events=None,
        metadata={'BuildMethod': 'makefile', 'SamResourceId': 'AbcDemoPowerShellFunction'},
        inlinecode=None, codesign_config_arn=None, architectures=None, function_url_config=None,
        stack_path='', runtime_management_config=None
    ))
2023-07-19 11:26:49,472 | Same Layer build definition found, adding layer (Previous: LayerBuildDefinition(AwsAbcPwshRuntimeLayer, G:\temp\2023-06-06-temp-Abc\2023.03.17-Abc\core\src\pass1\lab-lambda-runtime\awsAbc-powershell-runtime\source, 50c7aed6cc71dc323961c8fa7aa77f02eee63195f79eef204a04e74d15056821, b9be9c53-8604-40d8-8e6d-64d38fadd118, makefile, ['provided.al2'], x86_64, {}), Current: LayerBuildDefinition(AwsAbcPwshRuntimeLayer, G:\temp\2023-06-06-temp-Abc\2023.03.17-Abc\core\src\pass1\lab-lambda-runtime\awsAbc-powershell-runtime\source, , 52171dbf-4b89-4814-ae14-009473a6894f, makefile, ['provided.al2'], x86_64, {}), Layer: <samcli.lib.providers.provider.LayerVersion object at 0x0000011EE3B08880>)
2023-07-19 11:26:49,473 | Same Layer build definition found, adding layer (Previous: LayerBuildDefinition(LocalAbcImportLayer, H:/Abclayers/aws_email, 7a9c018c15c73b707134f02c600ebb4db8277c27f39d50d7e99fe1dcec5b1909, d42f8b29-fa96-4682-96ee-f825c39ed070, makefile, ['provided.al2'], x86_64, {}), Current: LayerBuildDefinition(LocalAbcImportLayer, H:/Abclayers/aws_email, , 3aeeb060-9ef7-42f2-9bbf-a612fd6af47b, makefile, ['provided.al2'], x86_64, {}), Layer: <samcli.lib.providers.provider.LayerVersion object at 0x0000011EE3B08EE0>)
2023-07-19 11:26:49,481 | Async execution started

2023-07-19 11:26:49,481 | Invoking function functools.partial (
        <bound method ParallelBuildStrategy.build_single_layer_definition
        of  <samcli.lib.build.build_strategy.ParallelBuildStrategy  object at 0x0000011EE3A39DC0>>,
            <samcli.lib.build.build_graph.LayerBuildDefinition      object at 0x0000011EE3D1D5E0> )

2023-07-19 11:26:49,483 | Running cached build for runtime makefile for following resources (
        <bound method LayerBuildDefinition.get_resource_full_paths
        of <samcli.lib.build.build_graph.LayerBuildDefinition object at 0x0000011EE3D1D5E0>> )

2023-07-19 11:26:49,484 | Invoking function functools.partial(
        <bound method ParallelBuildStrategy.build_single_layer_definition
        of <samcli.lib.build.build_strategy.ParallelBuildStrategy object at 0x0000011EE3A39DC0>>,
        <samcli.lib.build.build_graph.LayerBuildDefinition object at 0x0000011EE3D1D7C0> )

2023-07-19 11:26:49,485 | Running cached build for runtime makefile for following resources (<bound method LayerBuildDefinition.get_resource_full_paths of <samcli.lib.build.build_graph.LayerBuildDefinition object at 0x0000011EE3D1D7C0>>)
2023-07-19 11:26:49,485 | Waiting for async results
2023-07-19 11:26:49,491 | Valid cache found, copying previously built resources for following layers (AwsAbcPwshRuntimeLayer)
2023-07-19 11:26:49,492 | Copying artifacts from G:\user\demo-runtime-layer-function\.aws-sam\cache\b9be9c53-8604-40d8-8e6d-64d38fadd118 to G:\user\demo-runtime-layer-function\.aws-sam\build\AwsAbcPwshRuntimeLayer
2023-07-19 11:26:50,015 | Valid cache found, copying previously built resources for following layers (LocalAbcImportLayer)
2023-07-19 11:26:50,015 | Copying artifacts from G:\user\demo-runtime-layer-function\.aws-sam\cache\d42f8b29-fa96-4682-96ee-f825c39ed070 to G:\user\demo-runtime-layer-function\.aws-sam\build\LocalAbcImportLayer
2023-07-19 11:26:53,016 | Async execution completed
2023-07-19 11:26:53,019 | Async execution started
2023-07-19 11:26:53,019 | Invoking function functools.partial(<bound method ParallelBuildStrategy.build_single_function_definition of <samcli.lib.build.build_strategy.ParallelBuildStrategy object at 0x0000011EE3A39DC0>>, <samcli.lib.build.build_graph.FunctionBuildDefinition object at 0x0000011EE3C2ED90>)
2023-07-19 11:26:53,020 | Running incremental build for runtime provided.al2 for following resources (AbcDemoPowerShellFunction)
2023-07-19 11:26:53,020 | Waiting for async results
2023-07-19 11:26:53,600 | Cache is invalid, running build and copying resources for following functions (AbcDemoPowerShellFunction)
2023-07-19 11:26:53,601 | Building codeuri: G:\user\demo-runtime-layer-function\function runtime: provided.al2 metadata: {'BuildMethod': 'makefile'} architecture: x86_64 functions: AbcDemoPowerShellFunction
2023-07-19 11:26:53,601 | Building to following folder G:\user\demo-runtime-layer-function\.aws-sam\build\AbcDemoPowerShellFunction
2023-07-19 11:26:53,634 | Requested to skip pulling images ...

2023-07-19 11:26:53,634 | Mounting G:\user\demo-runtime-layer-function\function as /tmp/samcli/source:ro,delegated, inside runtime container
Using the request object from command line argument
Loading workflow module 'aws_lambda_builders.workflows'
Registering workflow 'CustomMakeBuilder'
        with capability 'Capability(language='provided',
        dependency_manager=None, application_framework=None)'
Registering workflow 'DotnetCliPackageBuilder'
        with capability 'Capability(language='dotnet',
        dependency_manager='cli-package', application_framework=None)'
Registering workflow 'GoModulesBuilder'
        with capability 'Capability(language='go',
        dependency_manager='modules', application_framework=None)'
Registering workflow 'JavaGradleWorkflow'
        with capability 'Capability(language='java',
        dependency_manager='gradle', application_framework=None)'
Registering workflow 'JavaMavenWorkflow'
        with capability 'Capability(language='java',
        dependency_manager='maven', application_framework=None)'
Registering workflow 'NodejsNpmBuilder'
        with capability 'Capability(language='nodejs',
        dependency_manager='npm', application_framework=None)'
Registering workflow 'NodejsNpmEsbuildBuilder'
        with capability 'Capability(language='nodejs',
        dependency_manager='npm-esbuild', application_framework=None)'
Registering workflow 'PythonPipBuilder'
        with capability 'Capability(language='python',
        dependency_manager='pip', application_framework=None)'
Registering workflow 'RubyBundlerBuilder'
        with capability 'Capability(language='ruby',
        dependency_manager='bundler', application_framework=None)'
Registering workflow 'RustCargoLambdaBuilder'
        with capability 'Capability(language='rust',
        dependency_manager='cargo', application_framework=None)'
Found workflow 'CustomMakeBuilder' to support capabilities 'Capability(language='provided',
dependency_manager=None, application_framework=None)'
Running workflow 'CustomMakeBuilder'
Running CustomMakeBuilder:CopySource
Copying source file (/tmp/samcli/source/.gitignore) to destination (/tmp/samcli/scratch/.gitignore)
...
Copying source file (/tmp/samcli/source/ImportExcel/7.8.4/SUMMARY.md) to destination (/tmp/samcli/scratch/ImportExcel/7.8.4/SUMMARY.md)
Copying source file (/tmp/samcli/source/Makefile) to destination (/tmp/samcli/scratch/Makefile)
CustomMakeBuilder:CopySource succeeded
Running CustomMakeBuilder:MakeBuild
Current Artifacts Directory : /tmp/samcli/artifacts
executing Make: ['make', '--makefile', '/tmp/samcli/source/Makefile', 'build-AbcDemoPowerShellFunction']
cp -R . /tmp/samcli/artifacts
rm /tmp/samcli/artifacts/Makefile
CustomMakeBuilder:MakeBuild succeeded
2023-07-19 11:27:03,526 | Failed to get the logs from the container
Traceback (most recent call last):
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\local\docker\container.py", line 433, in _write_container_output
    for stdout_data, stderr_data in output_itr:
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\types\daemon.py", line 32, in __next__
    return next(self._stream)
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\api\client.py", line 406, in <genexpr>
    gen = (demux_adaptor(*frame) for frame in gen)
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\utils\socket.py", line 94, in frames_iter_no_tty
    (stream, n) = next_frame_header(socket)
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\utils\socket.py", line 66, in next_frame_header
    data = read_exactly(socket, 8)
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\utils\socket.py", line 51, in read_exactly
    next_data = read(socket, n - len(data))
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\utils\socket.py", line 35, in read
    return socket.recv(n)
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\transport\npipesocket.py", line 23, in wrapped
    return f(self, *args, **kwargs)
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\transport\npipesocket.py", line 117, in recv
    err, data = win32file.ReadFile(self._handle, bufsize)
pywintypes.error: (109, 'ReadFile', 'The pipe has been ended.')
2023-07-19 11:27:03,542 | Build inside container returned response {"jsonrpc": "2.0", "id": 1, "result": {"artifacts_dir": "/tmp/samcli/artifacts"}}
2023-07-19 11:27:03,542 | Build inside container was successful. Copying artifacts from container to host
2023-07-19 11:27:03,874 | Copying from container: /tmp/samcli/artifacts/. -> G:\user\demo-runtime-layer-function\.aws-sam\build\AbcDemoPowerShellFunction
2023-07-19 11:27:04,443 | Build inside container succeeded
2023-07-19 11:27:07,956 | Async execution completed
2023-07-19 11:27:08,123 | There is no customer defined id or cdk path defined for resource AbcDemoPowerShellFunction, so we will use the resource logical id as the resource id
2023-07-19 11:27:08,124 | There is no customer defined id or cdk path defined for resource AwsAbcPwshRuntimeLayer, so we will use the resource logical id as the resource id
2023-07-19 11:27:08,125 | There is no customer defined id or cdk path defined for resource LocalAbcImportLayer, so we will use the resource logical id as the resource id
2023-07-19 11:27:08,126 | There is no customer defined id or cdk path defined for resource LocalAbcImportLayerJumpChangesParameter, so we will use the resource logical id as the resource id
2023-07-19 11:27:08,126 | There is no customer defined id or cdk path defined for resource DemoPwshRuntimeJumpChangesParameter, so we will use the resource logical id as the resource id
2023-07-19 11:27:08,127 | 5 resources found in the stack
2023-07-19 11:27:08,127 | Found Serverless function with name='AbcDemoPowerShellFunction' and CodeUri='function/'

Build Succeeded

Built Artifacts  : .aws-sam\build
Built Template   : .aws-sam\build\template.yaml

Commands you can use next
=========================
[*] Validate SAM template: sam validate
[*] Invoke Function: sam local invoke
[*] Test Function in the Cloud: sam sync --stack-name {{stack-name}} --watch
[*] Deploy: sam deploy --guided
2023-07-19 11:27:08,148 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2023-07-19 11:27:08,439 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2023-07-19 11:27:08,439 | Sending Telemetry: {'metrics': [{'commandRun': {'requestId': '01db095e-d6f3-4e65-9c32-4b865dd84358', 'installationId': '902552ea-7dd9-4993-b9a1-5d0c1c4a62d3', 'sessionId': '672d075e-661b-4dd2-94a3-80b3e56d490a', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.8.8', 'samcliVersion': '1.78.0', 'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam build', 'metricSpecificAttributes': {'projectType': 'CFN', 'gitOrigin': None, 'projectName': 'b4bfed5934f7476d447a39d07f20038e25a5e6f4e3514ffee4887969a20dfa9f', 'initialCommit': 'ec59a2a2366a7d4bc049aca332e9e6af3e0054ac873d1e0a7b3d2b614d5371fc'}, 'duration': 19847, 'exitReason': 'success', 'exitCode': 0}}]}
2023-07-19 11:27:08,440 | Unable to find Click Context for getting session_id.
2023-07-19 11:27:08,443 | Sending Telemetry: {'metrics': [{'events': {'requestId': 'bc008b48-cf1e-4c3a-97ee-ab3267126de4', 'installationId': '902552ea-7dd9-4993-b9a1-5d0c1c4a62d3', 'sessionId': '672d075e-661b-4dd2-94a3-80b3e56d490a', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.8.8', 'samcliVersion': '1.78.0', 'metricSpecificAttributes': {'events': [{'event_name': 'BuildWorkflowUsed', 'event_value': 'provided-None', 'thread_id': 32452, 'time_stamp': '2023-07-19 16:26:49.451'}, {'event_name': 'BuildWorkflowUsed', 'event_value': 'provided-None', 'thread_id': 32452, 'time_stamp': '2023-07-19 16:26:49.452'}, {'event_name': 'BuildWorkflowUsed', 'event_value': 'provided-None', 'thread_id': 32452, 'time_stamp': '2023-07-19 16:26:49.452'}, {'event_name': 'BuildFunctionRuntime', 'event_value': 'provided.al2', 'thread_id': 32452, 'time_stamp': '2023-07-19 16:26:49.453'}, {'event_name': 'BuildWorkflowUsed', 'event_value': 'provided-None', 'thread_id': 32452, 'time_stamp': '2023-07-19 16:26:53.602'}]}}}]}

2023-07-19 11:27:08,676 | Telemetry response: 200
2023-07-19 11:27:08,690 | Telemetry response: 200

@ninmonkey
Copy link

@betimer Does yours error 100% of the time? Mine will fail sometimes, but never 100% of the time. Maybe that could be a useful clue.
When mine fails, I just re-run the same sam build -- then it works.

> sam build ....
# error

> sam build ...
# good

> sam deploy
# good

@betimer
Copy link
Author

betimer commented Jul 20, 2023

@ninmonkey
For me, it is 100%. But there is a special package related prisma. It happens when adding prisma. I am curious why sam build will fail if adding some other package. So I think this should still be sam build issue

A work around I created a layer for prisma.

@ninmonkey
Copy link

ninmonkey commented Jul 22, 2023

@betimer Yes, I think it it is occurring in the sam cli. We are using different languages and get the same cli errors.

Something I noticed across our logs:

  • both of ours say building is successful
  • but, telemetry throws an exception
  • Errors messages say read timeouts failed.
  • a shared error fails around shutil.py calling _rmtree_unsafe

Mitigations?

quoting your log

2023-01-26 10:03:27,200 | executing Esbuild: ['C:\\Users\\betim\\AppData\\Roaming\\npm\\esbuild.CMD', 'app.ts',
    '--bundle', '--platform=node', '--outdir=C:\\xsrc\\test\\helper-funcs\\lw-data-puller\\.aws-sam\\build\\HelloWorldFunction',
    '--format=cjs', '--minify', '--sourcemap', '--target=es2020']
2023-01-26 10:03:27,349 | NodejsNpmEsbuildBuilder:EsbuildBundle succeeded
2023-01-26 10:03:28,352 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com',
    port=443): Read timed out. (read timeout=0.1)
2023-01-26 10:03:28,368 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com',
    port=443): Read timed out. (read timeout=0.1)
...
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\build\app_builder.py", line 698, in _build_function        
    return self._build_function_in_process(
  File "contextlib.py", line 120, in __exit__
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\utils\osutils.py", line 55, in mkdir_temp
    shutil.rmtree(temp_dir)  File "shutil.py", line 740, in rmtree
  File "shutil.py", line 622, in _rmtree_unsafe
  File "shutil.py", line 620, in _rmtree_unsafe

2023-01-26 10:03:27,349 | NodejsNpmEsbuildBuilder:EsbuildBundle succeeded
2023-01-26 10:03:27,410 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2023-01-26 10:03:27,541 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2023-01-26 10:03:27,541 | Sending Telemetry: {'metrics': [{'commandRun': {'requestId': '02267ee3-dd62-41cd-8c85-cf89d79190e5', 'installationId': 'cd053703-3a7b-4747-810c-de2bd43bd6bb', 'sessionId': '0e482360-8ad5-4778-9fc9-5591600571d0', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.8.8', 'samcliVersion': '1.71.0', 'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam build', 'metricSpecificAttributes': {'projectType': 'CFN', 'gitOrigin': 'f673268b4bb71792b05f3651d3a8ffabdfe6edb887c18ce348111085c33ecb72', 'projectName': '561615620ad6611c3163c312fb68c0a47e0b497750ff76f98bce9d7b98a6b2d0', 'initialCommit': '574dd9a3b3632e5a39b8cb7d4535c430c570677b592322fb4920f94e113191ba'}, 'duration': 12012, 'exitReason': 'PermissionError', 'exitCode': 255}}]}
2023-01-26 10:03:27,541 | Unable to find Click Context for getting session_id.
2023-01-26 10:03:27,543 | Sending Telemetry: {'metrics': [{'events': {'requestId': 'deb4bba8-70e4-4f47-a5ed-f741f95560a2', 'installationId': 'cd053703-3a7b-4747-810c-de2bd43bd6bb', 'sessionId': '0e482360-8ad5-4778-9fc9-5591600571d0', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.8.8', 'samcliVersion': '1.71.0', 'metricSpecificAttributes': {'events': [{'event_name': 'BuildWorkflowUsed', 'event_value': 'nodejs-npm-esbuild', 'thread_id': 17724, 'time_stamp': '2023-01-25 23:03:16.698'}]}}}]}
2023-01-26 10:03:28,352 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)
2023-01-26 10:03:28,368 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)

Error: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\betim\\AppData\\Local\\Temp\\tmp0dxp9sgw'
Traceback:
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 1657, 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 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\telemetry\metric.py", line 183, in wrapped
    raise exception  # pylint: disable=raising-bad-type
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\telemetry\metric.py", line 150, in wrapped
    return_value = func(*args, **kwargs)
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\utils\version_checker.py", line 41, in wrapped
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\commands\build\build_context.py", line 261, in run
    build_result = builder.build()
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\build\app_builder.py", line 214, in build
    return ApplicationBuildResult(build_graph, build_strategy.build())
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\build\build_strategy.py", line 80, in build
    result.update(self._build_functions(self._build_graph))
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\build\build_strategy.py", line 90, in _build_functions     
    function_build_results.update(self.build_single_function_definition(build_definition))
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\build\build_strategy.py", line 163, in build_single_function_definition
    result = self._build_function(
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\build\app_builder.py", line 698, in _build_function        
    return self._build_function_in_process(
  File "contextlib.py", line 120, in __exit__
  File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\samcli\lib\utils\osutils.py", line 55, in mkdir_temp
    shutil.rmtree(temp_dir)  File "shutil.py", line 740, in rmtree
  File "shutil.py", line 622, in _rmtree_unsafe
  File "shutil.py", line 620, in _rmtree_unsafe

</p>
</details> 

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

No branches or pull requests

4 participants