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

Bug: Unsupported Lambda runtime java17 #6867

Closed
mharisahmed opened this issue Mar 22, 2024 · 3 comments
Closed

Bug: Unsupported Lambda runtime java17 #6867

mharisahmed opened this issue Mar 22, 2024 · 3 comments
Labels
blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale.

Comments

@mharisahmed
Copy link

mharisahmed commented Mar 22, 2024

Description:

I am trying to invoke the sam local It throws an error of unsupported runtime java17.

Steps to reproduce:

command: sam local invoke "Function" -e src/test/resources/event/new-config-with-variant.json --debug

Observed result:

`X@INR-HQ-X mdm-product-sync % sam local invoke "Function" -e src/test/resources/event/new-config-with-variant.json --debug
2024-03-22 02:03:00,166 | Config file location: /Users/X/Documents/Flaconi/mdm-product-sync/samconfig.toml
2024-03-22 02:03:00,166 | Config file '/Users/X/Documents/Flaconi/mdm-product-sync/samconfig.toml' does not exist
2024-03-22 02:03:00,169 | Using SAM Template at /Users/X/Documents/Flaconi/mdm-product-sync/template.yml
2024-03-22 02:03:00,216 | Using config file: samconfig.toml, config environment: default
2024-03-22 02:03:00,216 | Expand command line arguments to:
2024-03-22 02:03:00,216 | --template_file=/Users/X/Documents/Flaconi/mdm-product-sync/template.yml --event=src/test/resources/event/new-config-with-variant.json --function_logical_id=Function --no_event --layer_cache_basedir=/Users/X/.aws-sam/layers-pkg --container_host=localhost --container_host_interface=127.0.0.1
2024-03-22 02:03:00,216 | local invoke command is called
2024-03-22 02:03:00,219 | No Parameters detected in the template
2024-03-22 02:03:00,308 | There is no customer defined id or cdk path defined for resource Function, so we will use the resource logical id as the resource id
2024-03-22 02:03:00,308 | 0 stacks found in the template
2024-03-22 02:03:00,308 | No Parameters detected in the template
2024-03-22 02:03:00,321 | There is no customer defined id or cdk path defined for resource Function, so we will use the resource logical id as the resource id
2024-03-22 02:03:00,321 | 1 resources found in the stack
2024-03-22 02:03:00,321 | Found Serverless function with name='Function' and CodeUri='build/distributions/mdm-product-sync-0.1.zip'
2024-03-22 02:03:00,321 | --base-dir is not presented, adjusting uri build/distributions/mdm-product-sync-0.1.zip relative to /Users/X/Documents/Flaconi/mdm-product-sync/template.yml
2024-03-22 02:03:04,491 | Found one Lambda function with name 'Function'
2024-03-22 02:03:04,491 | Invoking de.flaconi.ng.common.lambda.RequestStreamHandler::handleRequest (java17)
2024-03-22 02:03:04,491 | No environment variables found for function 'Function'
2024-03-22 02:03:04,491 | Loading AWS credentials from session with profile 'None'
2024-03-22 02:03:04,520 | Resolving code path. Cwd=/Users/X/Documents/Flaconi/mdm-product-sync, CodeUri=/Users/X/Documents/Flaconi/mdm-product-sync/build/distributions/mdm-product-sync-0.1.zip
2024-03-22 02:03:04,521 | Resolved absolute path to code is /Users/X/Documents/Flaconi/mdm-product-sync/build/distributions/mdm-product-sync-0.1.zip
2024-03-22 02:03:04,535 | Decompressing /Users/X/Documents/Flaconi/mdm-product-sync/build/distributions/mdm-product-sync-0.1.zip
2024-03-22 02:03:05,241 | Cleaning all decompressed code dirs
2024-03-22 02:03:05,382 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2024-03-22 02:03:05,576 | Sending Telemetry: {'metrics': [{'commandRun': {'requestId': 'xxxxx-c991-4576-8f93-64e30c5eb2f5', 'installationId': 'xxxxx-f983-4fe7-94e3-f9687820198b', 'sessionId': 'xxxxxx-c4e3-4d09-b29d-9fe718d52b49', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.8.13', 'samcliVersion': '1.76.0', 'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam local invoke', 'metricSpecificAttributes': {'projectType': 'CFN', 'gitOrigin': None, 'projectName': 'xxxx40c8e23b5dfbe74a5a67aed6fa154xxxxxxxx8e3adec61', 'initialCommit': None}, 'duration': 5166, 'exitReason': 'ValueError', 'exitCode': 255}}]}
2024-03-22 02:03:06,116 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)

Error: Unsupported Lambda runtime java17
Traceback:
File "click/core.py", line 1055, in main
File "click/core.py", line 1657, in invoke
File "click/core.py", line 1657, in invoke
File "click/core.py", line 1404, in invoke
File "click/core.py", line 760, in invoke
File "click/decorators.py", line 84, in new_func
File "click/core.py", line 760, in invoke
File "samcli/lib/telemetry/metric.py", line 183, in wrapped
File "samcli/lib/telemetry/metric.py", line 148, in wrapped
File "samcli/lib/utils/version_checker.py", line 42, in wrapped
File "samcli/cli/main.py", line 92, in wrapper
File "samcli/commands/local/invoke/cli.py", line 96, in cli
File "samcli/commands/local/invoke/cli.py", line 203, in do_cli
File "samcli/commands/local/lib/local_lambda.py", line 144, in invoke
File "samcli/lib/telemetry/metric.py", line 323, in wrapped_func
File "samcli/local/lambdafn/runtime.py", line 189, in invoke
File "samcli/local/lambdafn/runtime.py", line 85, in create
File "samcli/local/docker/lambda_container.py", line 92, in init

An unexpected error was encountered while executing "sam local invoke".
Search for an existing issue:
https://github.com/aws/aws-sam-cli/issues?q=is%3Aissue+is%3Aopen+Bug%3A%20sam%20local%20invoke%20-%20ValueError
Or create a bug report:
https://github.com/aws/aws-sam-cli/issues/new?template=Bug_report.md&title=Bug%3A%20sam%20local%20invoke%20-%20ValueError
`

Expected result:

Should have invoked lambda locally as it was supposed to do with runtime java11

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

operating system: MAC
python version: 3.10.9
Java: 17.0.10

  1. OS:
  2. sam --version:
  3. AWS region:
# Paste the output of `sam --info` here
{
  "version": "1.76.0",
  "system": {
    "python": "3.8.13",
    "os": "macOS-14.4-x86_64-i386-64bit"
  },
  "additional_dependencies": {
    "docker_engine": "25.0.3",
    "aws_cdk": "Not available",
    "terraform": "1.3.9"
  }
}

@mharisahmed mharisahmed added the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label Mar 22, 2024
@mildaniel
Copy link
Contributor

Hey @mharisahmed, it looks like you might be using an outdated version of SAM CLI. Can you update to the latest version and see if that resolves your issue?

@mildaniel mildaniel added blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale. and removed stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Mar 22, 2024
@mharisahmed
Copy link
Author

@mildaniel thanks for your help. It worked with following version
{ "version": "1.113.0", "system": { "python": "3.8.13", "os": "macOS-14.4-x86_64-i386-64bit" }, "additional_dependencies": { "docker_engine": "25.0.3", "aws_cdk": "Not available", "terraform": "1.3.9" }, "available_beta_feature_env_vars": [ "SAM_CLI_BETA_FEATURES", "SAM_CLI_BETA_BUILD_PERFORMANCE", "SAM_CLI_BETA_TERRAFORM_SUPPORT", "SAM_CLI_BETA_RUST_CARGO_LAMBDA" ] }

Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale.
Projects
None yet
Development

No branches or pull requests

2 participants