Open SushritPasupuleti opened 1 year ago
Hi there,
I've just instantiated a template with Rust lambda function, and I was able to run sam build
with it. This is my environment;
❯ sam --version
SAM CLI, version 1.83.0
❯ cargo --version
cargo 1.67.1 (8ecd4f20a 2023-01-10)
❯ rustc --version
rustc 1.67.1 (d5a82bbd2 2023-02-07)
❯ cargo-lambda lambda --version
cargo-lambda 0.17.2 (fd5a334-dirty 2023-03-03Z)
Can you provide more details of the error?
Thank you for responding. Here's my environment based on the commands you've used:
> sam --version
SAM CLI, version 1.83.0
> cargo --version
cargo 1.69.0 (6e9a83356 2023-04-12)
> rustc --version
rustc 1.69.0 (84c898d65 2023-04-16)
> cargo-lambda lambda --version
cargo-lambda 0.19.1 (2023-05-16Z)
I ended up switching to the source version of cargo-lambda
since I was using a nix
package as well, still no luck.
I'll try setting up everything in a VM based on my current configuration and try reproducing this.
@SushritPasupuleti could you please share the full logs of sam build
command with --debug
flag.
@SushritPasupuleti could you please share the full logs of
sam build
command with--debug
flag.
Sure, here are the logs:
When using -u
:
2023-05-26 09:13:35,752 | Config file location: /home/sushrit_lawliet/code/AWS-SAM-Test/rusty-sam-app/samconfig.toml
2023-05-26 09:13:35,754 | Loading configuration values from [default.['build'].parameters] (env.command_name.section) in config file at
'/home/sushrit_lawliet/code/AWS-SAM-Test/rusty-sam-app/samconfig.toml'...
2023-05-26 09:13:35,757 | Configuration values successfully loaded.
2023-05-26 09:13:35,758 | Configuration values are: {'stack_name': 'rusty-sam-app', 'cached': True, 'parallel': True}
2023-05-26 09:13:35,760 | Using SAM Template at /home/sushrit_lawliet/code/AWS-SAM-Test/rusty-sam-app/template.yaml
2023-05-26 09:13:35,769 | Using config file: samconfig.toml, config environment: default
2023-05-26 09:13:35,770 | Expand command line arguments to:
2023-05-26 09:13:35,770 | --template_file=/home/sushrit_lawliet/code/AWS-SAM-Test/rusty-sam-app/template.yaml --use_container --parallel --mount_with=READ
--build_dir=.aws-sam/build --cache_dir=.aws-sam/cache --cached
2023-05-26 09:13:35,797 | 'build' command is called
2023-05-26 09:13:35,797 | Starting Build use cache
2023-05-26 09:13:35,798 | Starting Build inside a container
2023-05-26 09:13:35,800 | No Parameters detected in the template
2023-05-26 09:13:35,811 | 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-05-26 09:13:35,812 | 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-05-26 09:13:35,813 | 0 stacks found in the template
2023-05-26 09:13:35,813 | No Parameters detected in the template
2023-05-26 09:13:35,822 | 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-05-26 09:13:35,822 | 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-05-26 09:13:35,823 | 2 resources found in the stack
2023-05-26 09:13:35,823 | Found Serverless function with name='HelloWorldFunction' and CodeUri='./rust_app'
2023-05-26 09:13:35,824 | --base-dir is not presented, adjusting uri ./rust_app relative to /home/sushrit_lawliet/code/AWS-SAM-Test/rusty-sam-app/template.yaml
2023-05-26 09:13:35,826 | 2 resources found in the stack
2023-05-26 09:13:35,826 | Found Serverless function with name='HelloWorldFunction' and CodeUri='./rust_app'
Build method "rust-cargolambda" is a beta feature.
Please confirm if you would like to proceed
You can also enable this beta feature with "sam build --beta-features". [y/N]: y
2023-05-26 09:13:39,380 | [33m
Experimental features are enabled for this session.
Visit the docs page to learn more about the AWS Beta terms https://aws.amazon.com/service-terms/.
[0m
2023-05-26 09:13:39,381 | Instantiating build definitions
2023-05-26 09:13:39,383 | Same function build definition found, adding function (Previous: BuildDefinition(provided.al2,
/home/sushrit_lawliet/code/AWS-SAM-Test/rusty-sam-app/rust_app, Zip, , 36b3e1cf-377b-486c-b7e8-33f6bee16c69, {'BuildMethod': 'rust-cargolambda'}, {}, x86_64,
[]), Current: BuildDefinition(provided.al2, /home/sushrit_lawliet/code/AWS-SAM-Test/rusty-sam-app/rust_app, Zip, , 85469f90-809c-4d5c-aaf8-e667a020e8d1,
{'BuildMethod': 'rust-cargolambda'}, {}, x86_64, []), Function: Function(function_id='HelloWorldFunction', name='HelloWorldFunction',
functionname='HelloWorldFunction', runtime='provided.al2', memory=128, timeout=3, handler='bootstrap', imageuri=None, packagetype='Zip', imageconfig=None,
codeuri='/home/sushrit_lawliet/code/AWS-SAM-Test/rusty-sam-app/rust_app', environment=None, rolearn=None, layers=[], events={'HelloWorld': {'Type': 'Api',
'Properties': {'Path': '/hello', 'Method': 'get', 'RestApiId': 'ServerlessRestApi'}}}, metadata={'BuildMethod': 'rust-cargolambda', 'SamResourceId':
'HelloWorldFunction'}, inlinecode=None, codesign_config_arn=None, architectures=['x86_64'], function_url_config=None, stack_path='',
runtime_management_config=None))
2023-05-26 09:13:39,386 | Async execution started
2023-05-26 09:13:39,387 | Invoking function functools.partial(<bound method ParallelBuildStrategy.build_single_function_definition of
<samcli.lib.build.build_strategy.ParallelBuildStrategy object at 0x7f33b27d0c50>>, <samcli.lib.build.build_graph.FunctionBuildDefinition object at
0x7f33b27d2c50>)
2023-05-26 09:13:39,388 | Running incremental build for runtime provided.al2 for following resources (HelloWorldFunction)
2023-05-26 09:13:39,388 | Waiting for async results
2023-05-26 09:13:40,614 | Cache is invalid, running build and copying resources for following functions (HelloWorldFunction)
2023-05-26 09:13:40,615 | Building codeuri: /home/sushrit_lawliet/code/AWS-SAM-Test/rusty-sam-app/rust_app runtime: provided.al2 metadata: {'BuildMethod':
'rust-cargolambda'} architecture: x86_64 functions: HelloWorldFunction
2023-05-26 09:13:40,615 | Building to following folder /home/sushrit_lawliet/code/AWS-SAM-Test/rusty-sam-app/.aws-sam/build/HelloWorldFunction
Fetching public.ecr.aws/sam/build-provided.al2:latest-x86_64 Docker container image................................................................................................................................................................................................................................................................................................................
2023-05-26 09:14:07,229 | Mounting /home/sushrit_lawliet/code/AWS-SAM-Test/rusty-sam-app/rust_app 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 'RustCargoLambdaBuilder' to support capabilities 'Capability(language='rust', dependency_manager='cargo', application_framework=None)'
Builder workflow failed
Traceback (most recent call last):
File "/usr/local/opt/sam-cli/lib64/python3.7/site-packages/aws_lambda_builders/workflow.py", line 78, in wrapper
if not binary_checker.path_provided
File "/usr/local/opt/sam-cli/lib64/python3.7/site-packages/aws_lambda_builders/path_resolver.py", line 33, in exec_paths
return self._which()
File "/usr/local/opt/sam-cli/lib64/python3.7/site-packages/aws_lambda_builders/path_resolver.py", line 27, in _which
"Path resolution for runtime: {} of binary: " "{} was not successful".format(self.runtime, self.binary)
ValueError: Path resolution for runtime: provided of binary: cargo was not successful
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/opt/sam-cli/lib64/python3.7/site-packages/aws_lambda_builders/__main__.py", line 133, in main
build_in_source=params.get("build_in_source", None),
File "/usr/local/opt/sam-cli/lib64/python3.7/site-packages/aws_lambda_builders/builder.py", line 170, in build
return workflow.run()
File "/usr/local/opt/sam-cli/lib64/python3.7/site-packages/aws_lambda_builders/workflow.py", line 82, in wrapper
raise WorkflowFailedError(workflow_name=self.NAME, action_name="Resolver", reason=str(ex))
aws_lambda_builders.exceptions.WorkflowFailedError: RustCargoLambdaBuilder:Resolver - Path resolution for runtime: provided of binary: cargo was not successful
2023-05-26 09:14:08,732 | Build inside container returned response {"jsonrpc": "2.0", "id": 1, "error": {"code": 400, "message": "RustCargoLambdaBuilder:Resolver
- Path resolution for runtime: provided of binary: cargo was not successful"}}
2023-05-26 09:14:08,870 | Exception raised during the execution
Build Failed
2023-05-26 09:14:08,872 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2023-05-26 09:14:08,880 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2023-05-26 09:14:08,881 | Sending Telemetry: {'metrics': [{'commandRunExperimental': {'requestId': 'd9ca01bc-830c-468a-8b08-32ae1820d806', 'installationId':
'78ad8ba6-1974-4a5d-8cc4-8148375fdb8a', 'sessionId': '1ae5e9ee-0a81-43df-ac07-93bacd969fab', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.7.10',
'samcliVersion': '1.83.0', 'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam build', 'metricSpecificAttributes':
{'experimentalAll': False, 'experimentalBuildPerformance': False, 'experimentalTerraformSupport': False, 'experimentalCargoLambda': True, 'projectType': 'CFN',
'gitOrigin': None, 'projectName': '772db6715cdc8fde1c7c7aecde5f0f39c5dbeb35b83da895732182f8f317be18', 'initialCommit': None}, 'duration': 33102, 'exitReason':
'BuildInsideContainerError', 'exitCode': 1}}]}
2023-05-26 09:14:08,881 | Unable to find Click Context for getting session_id.
2023-05-26 09:14:08,884 | Sending Telemetry: {'metrics': [{'events': {'requestId': '816565e7-d6bd-4661-a180-76be388de23d', 'installationId':
'78ad8ba6-1974-4a5d-8cc4-8148375fdb8a', 'sessionId': '1ae5e9ee-0a81-43df-ac07-93bacd969fab', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.7.10',
'samcliVersion': '1.83.0', 'metricSpecificAttributes': {'events': [{'event_name': 'BuildWorkflowUsed', 'event_value': 'rust-cargo', 'thread_id': 139860346526592,
'time_stamp': '2023-05-26 03:43:35.827', 'exception_name': None}, {'event_name': 'BuildFunctionRuntime', 'event_value': 'provided.al2', 'thread_id':
139860346526592, 'time_stamp': '2023-05-26 03:43:39.381', 'exception_name': None}, {'event_name': 'BuildWorkflowUsed', 'event_value': 'rust-cargo', 'thread_id':
139860346526592, 'time_stamp': '2023-05-26 03:43:40.616', 'exception_name': None}]}}}]}
2023-05-26 09:14:09,840 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)
2023-05-26 09:14:09,865 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)
Error: RustCargoLambdaBuilder:Resolver - Path resolution for runtime: provided of binary: cargo was not successful
Without -u
:
2023-05-26 09:15:51,475 | Config file location: /home/sushrit_lawliet/code/AWS-SAM-Test/rusty-sam-app/samconfig.toml
2023-05-26 09:15:51,477 | Loading configuration values from [default.['build'].parameters] (env.command_name.section) in config file at
'/home/sushrit_lawliet/code/AWS-SAM-Test/rusty-sam-app/samconfig.toml'...
2023-05-26 09:15:51,480 | Configuration values successfully loaded.
2023-05-26 09:15:51,481 | Configuration values are: {'stack_name': 'rusty-sam-app', 'cached': True, 'parallel': True}
2023-05-26 09:15:51,483 | Using SAM Template at /home/sushrit_lawliet/code/AWS-SAM-Test/rusty-sam-app/template.yaml
2023-05-26 09:15:51,492 | Using config file: samconfig.toml, config environment: default
2023-05-26 09:15:51,493 | Expand command line arguments to:
2023-05-26 09:15:51,493 | --template_file=/home/sushrit_lawliet/code/AWS-SAM-Test/rusty-sam-app/template.yaml --parallel --mount_with=READ
--build_dir=.aws-sam/build --cache_dir=.aws-sam/cache --cached
2023-05-26 09:15:51,518 | 'build' command is called
2023-05-26 09:15:51,519 | Starting Build use cache
2023-05-26 09:15:51,521 | No Parameters detected in the template
2023-05-26 09:15:51,532 | 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-05-26 09:15:51,532 | 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-05-26 09:15:51,533 | 0 stacks found in the template
2023-05-26 09:15:51,533 | No Parameters detected in the template
2023-05-26 09:15:51,542 | 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-05-26 09:15:51,542 | 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-05-26 09:15:51,543 | 2 resources found in the stack
2023-05-26 09:15:51,543 | Found Serverless function with name='HelloWorldFunction' and CodeUri='./rust_app'
2023-05-26 09:15:51,543 | --base-dir is not presented, adjusting uri ./rust_app relative to /home/sushrit_lawliet/code/AWS-SAM-Test/rusty-sam-app/template.yaml
2023-05-26 09:15:51,546 | 2 resources found in the stack
2023-05-26 09:15:51,546 | Found Serverless function with name='HelloWorldFunction' and CodeUri='./rust_app'
Build method "rust-cargolambda" is a beta feature.
Please confirm if you would like to proceed
You can also enable this beta feature with "sam build --beta-features". [y/N]: y
2023-05-26 09:15:53,042 | [33m
Experimental features are enabled for this session.
Visit the docs page to learn more about the AWS Beta terms https://aws.amazon.com/service-terms/.
[0m
2023-05-26 09:15:53,043 | Instantiating build definitions
2023-05-26 09:15:53,045 | Same function build definition found, adding function (Previous: BuildDefinition(provided.al2,
/home/sushrit_lawliet/code/AWS-SAM-Test/rusty-sam-app/rust_app, Zip, , 36b3e1cf-377b-486c-b7e8-33f6bee16c69, {'BuildMethod': 'rust-cargolambda'}, {}, x86_64,
[]), Current: BuildDefinition(provided.al2, /home/sushrit_lawliet/code/AWS-SAM-Test/rusty-sam-app/rust_app, Zip, , e243ee82-f17c-4caf-91a9-c4bcf6295031,
{'BuildMethod': 'rust-cargolambda'}, {}, x86_64, []), Function: Function(function_id='HelloWorldFunction', name='HelloWorldFunction',
functionname='HelloWorldFunction', runtime='provided.al2', memory=128, timeout=3, handler='bootstrap', imageuri=None, packagetype='Zip', imageconfig=None,
codeuri='/home/sushrit_lawliet/code/AWS-SAM-Test/rusty-sam-app/rust_app', environment=None, rolearn=None, layers=[], events={'HelloWorld': {'Type': 'Api',
'Properties': {'Path': '/hello', 'Method': 'get', 'RestApiId': 'ServerlessRestApi'}}}, metadata={'BuildMethod': 'rust-cargolambda', 'SamResourceId':
'HelloWorldFunction'}, inlinecode=None, codesign_config_arn=None, architectures=['x86_64'], function_url_config=None, stack_path='',
runtime_management_config=None))
2023-05-26 09:15:53,048 | Async execution started
2023-05-26 09:15:53,048 | Invoking function functools.partial(<bound method ParallelBuildStrategy.build_single_function_definition of
<samcli.lib.build.build_strategy.ParallelBuildStrategy object at 0x7f4455ed9310>>, <samcli.lib.build.build_graph.FunctionBuildDefinition object at
0x7f4455ebf510>)
2023-05-26 09:15:53,049 | Running incremental build for runtime provided.al2 for following resources (HelloWorldFunction)
2023-05-26 09:15:53,050 | Waiting for async results
2023-05-26 09:15:53,684 | Cache is invalid, running build and copying resources for following functions (HelloWorldFunction)
2023-05-26 09:15:53,685 | Building codeuri: /home/sushrit_lawliet/code/AWS-SAM-Test/rusty-sam-app/rust_app runtime: provided.al2 metadata: {'BuildMethod':
'rust-cargolambda'} architecture: x86_64 functions: HelloWorldFunction
2023-05-26 09:15:53,685 | Building to following folder /home/sushrit_lawliet/code/AWS-SAM-Test/rusty-sam-app/.aws-sam/build/HelloWorldFunction
2023-05-26 09:15:53,686 | Loading workflow module 'aws_lambda_builders.workflows'
2023-05-26 09:15:53,687 | Registering workflow 'CustomMakeBuilder' with capability 'Capability(language='provided', dependency_manager=None,
application_framework=None)'
2023-05-26 09:15:53,688 | Registering workflow 'DotnetCliPackageBuilder' with capability 'Capability(language='dotnet', dependency_manager='cli-package',
application_framework=None)'
2023-05-26 09:15:53,689 | Registering workflow 'GoModulesBuilder' with capability 'Capability(language='go', dependency_manager='modules',
application_framework=None)'
2023-05-26 09:15:53,690 | Registering workflow 'JavaGradleWorkflow' with capability 'Capability(language='java', dependency_manager='gradle',
application_framework=None)'
2023-05-26 09:15:53,691 | Registering workflow 'JavaMavenWorkflow' with capability 'Capability(language='java', dependency_manager='maven',
application_framework=None)'
2023-05-26 09:15:53,692 | Registering workflow 'NodejsNpmBuilder' with capability 'Capability(language='nodejs', dependency_manager='npm',
application_framework=None)'
2023-05-26 09:15:53,693 | Registering workflow 'NodejsNpmEsbuildBuilder' with capability 'Capability(language='nodejs', dependency_manager='npm-esbuild',
application_framework=None)'
2023-05-26 09:15:53,695 | Registering workflow 'PythonPipBuilder' with capability 'Capability(language='python', dependency_manager='pip',
application_framework=None)'
2023-05-26 09:15:53,696 | Registering workflow 'RubyBundlerBuilder' with capability 'Capability(language='ruby', dependency_manager='bundler',
application_framework=None)'
2023-05-26 09:15:53,697 | Registering workflow 'RustCargoLambdaBuilder' with capability 'Capability(language='rust', dependency_manager='cargo',
application_framework=None)'
2023-05-26 09:15:53,697 | Found workflow 'RustCargoLambdaBuilder' to support capabilities 'Capability(language='rust', dependency_manager='cargo',
application_framework=None)'
2023-05-26 09:15:53,698 | Exception raised during the execution
Build Failed
2023-05-26 09:15:53,700 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2023-05-26 09:15:53,709 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2023-05-26 09:15:53,710 | Sending Telemetry: {'metrics': [{'commandRunExperimental': {'requestId': '40bfd2ee-1e50-4efb-9a4e-06aa07fa72e5', 'installationId':
'78ad8ba6-1974-4a5d-8cc4-8148375fdb8a', 'sessionId': 'cfb8f999-7953-4320-8d60-1fd66c661e41', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.7.10',
'samcliVersion': '1.83.0', 'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam build', 'metricSpecificAttributes':
{'experimentalAll': False, 'experimentalBuildPerformance': False, 'experimentalTerraformSupport': False, 'experimentalCargoLambda': True, 'projectType': 'CFN',
'gitOrigin': None, 'projectName': '772db6715cdc8fde1c7c7aecde5f0f39c5dbeb35b83da895732182f8f317be18', 'initialCommit': None}, 'duration': 2208, 'exitReason':
'WorkflowFailedError', 'exitCode': 1}}]}
2023-05-26 09:15:53,710 | Unable to find Click Context for getting session_id.
2023-05-26 09:15:53,712 | Sending Telemetry: {'metrics': [{'events': {'requestId': '79076594-e842-418f-a549-473f840ad9e0', 'installationId':
'78ad8ba6-1974-4a5d-8cc4-8148375fdb8a', 'sessionId': 'cfb8f999-7953-4320-8d60-1fd66c661e41', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.7.10',
'samcliVersion': '1.83.0', 'metricSpecificAttributes': {'events': [{'event_name': 'BuildFunctionRuntime', 'event_value': 'provided.al2', 'thread_id':
139931808197504, 'time_stamp': '2023-05-26 03:45:53.043', 'exception_name': None}, {'event_name': 'BuildWorkflowUsed', 'event_value': 'rust-cargo', 'thread_id':
139931808197504, 'time_stamp': '2023-05-26 03:45:53.686', 'exception_name': None}]}}}]}
2023-05-26 09:15:54,725 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)
2023-05-26 09:15:54,745 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)
Error: RustCargoLambdaBuilder:Resolver - Path resolution for runtime: provided of binary: cargo was not successful
For build in container, we do not have an image that contains the rust
setup, that is why you get the exception ValueError: Path resolution for runtime: provided of binary: cargo was not successful
... we should fix this issue.
The normal build problem is weird for me, we should see some more details about the exception, it seems it got caught some where in the code. Anyway, it seems it failed while trying to resolve the Rust binaries (you can find the logic here, and here). Can you run which cargo
and which cargo-lambda
in your environment and share the output with us.
Sure, here's the results:
> which cargo
/home/sushrit_lawliet/.cargo/bin/cargo
> which cargo-lambda
/home/sushrit_lawliet/.cargo/bin/cargo-lambda
I'm currently combing through my dot files to see if I have any weird environment variable-related issues with cargo setup. Will update if I find something, but so far I have not been able to move beyond this particular error across 2 VMs with the same config.
Any luck? I'm running into the same issue.
@manaskarekar Are you using Fedora too?
@manaskarekar Are you using Fedora too?
No, I'm using Xubuntu.
I was getting the same issue. In my case the issue was that I specified the path to cargo using relative path starting from home cabinet (PATH=~/.cargo/bin
). according to the post https://stackoverflow.com/questions/2057045/os-makedirs-doesnt-understand-in-my-path python is not bash and doesn't expand ~ (which cargo
will work). os.path.exists(fn)
will fail in this case at https://github.com/aws/aws-lambda-builders/blob/28becaf1acdcb5d51e9b2ed20df63f0f3d6a68e4/aws_lambda_builders/utils.py#L126C1-L127C84
Any fixes for this? I'm also stuck on the same situation.
Cache is invalid, running build and copying resources for following functions (HelloWorldFunction)
Building codeuri: /home/krishnan/Projects/rust/sam-app/rust_app runtime: provided.al2 metadata: {'BuildMethod':
'rust-cargolambda'} architecture: x86_64 functions: HelloWorldFunction
Build Failed
Error: RustCargoLambdaBuilder:Resolver - Path resolution for runtime: provided of binary: cargo was not successful
For build in container, we do not have an image that contains the
rust
setup, that is why you get the exceptionValueError: Path resolution for runtime: provided of binary: cargo was not successful
... we should fix this issue.The normal build problem is weird for me, we should see some more details about the exception, it seems it got caught some where in the code. Anyway, it seems it failed while trying to resolve the Rust binaries (you can find the logic here, and here). Can you run
which cargo
andwhich cargo-lambda
in your environment and share the output with us.
Any updates on the container build ?
Description:
When trying to build the Rust Hello World sample, the following error is encountered:
Building with
--use-container
yields the same error.Cargo is on
$PATH
as well.Steps to reproduce:
Setup the rust HelloWorld example from
sam init
and try to build it.Observed result:
Expected result:
It should build successfully
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
: 1.83.0.