aws / aws-sam-cli

CLI tool to build, test, debug, and deploy Serverless applications using AWS SAM
https://aws.amazon.com/serverless/sam/
Apache License 2.0
6.53k stars 1.17k forks source link

Error: 'NoneType' object has no attribute 'group' #7730

Open nikitasius opened 6 days ago

nikitasius commented 6 days ago

Hi folks, idk what you did but 1.130.0 crashing when i deploy my stuff. Last working for me is 1.129.0.

Description:

sam validate --lint && sam build && sam deploy --no-confirm-changeset --no-fail-on-empty-changeset --no-progressbar

Error: 'NoneType' object has no attribute 'group'
Traceback:
  File "/home/runner/work/_temp/setup-sam-ccGfbF/.venv/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/runner/work/_temp/setup-sam-ccGfbF/.venv/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/runner/work/_temp/setup-sam-ccGfbF/.venv/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/runner/work/_temp/setup-sam-ccGfbF/.venv/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/runner/work/_temp/setup-sam-ccGfbF/.venv/lib/python3.10/site-packages/samcli/cli/cli_config_file.py", line 347, in wrapper
    return func(*args, **kwargs)
  File "/home/runner/work/_temp/setup-sam-ccGfbF/.venv/lib/python3.10/site-packages/click/decorators.py", line 92, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/runner/work/_temp/setup-sam-ccGfbF/.venv/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/runner/work/_temp/setup-sam-ccGfbF/.venv/lib/python3.10/site-packages/samcli/lib/telemetry/metric.py", line 185, in wrapped
    raise exception  # pylint: disable=raising-bad-type
  File "/home/runner/work/_temp/setup-sam-ccGfbF/.venv/lib/python3.10/site-packages/samcli/lib/telemetry/metric.py", line 150, in wrapped
    return_value = func(*args, **kwargs)
  File "/home/runner/work/_temp/setup-sam-ccGfbF/.venv/lib/python3.10/site-packages/samcli/lib/utils/version_checker.py", line 43, in wrapped
    actual_result = func(*args, **kwargs)
  File "/home/runner/work/_temp/setup-sam-ccGfbF/.venv/lib/python3.10/site-packages/samcli/cli/main.py", line 95, in wrapper
    return func(*args, **kwargs)
  File "/home/runner/work/_temp/setup-sam-ccGfbF/.venv/lib/python3.10/site-packages/samcli/commands/build/command.py", line 169, in cli
    do_cli(
  File "/home/runner/work/_temp/setup-sam-ccGfbF/.venv/lib/python3.10/site-packages/samcli/commands/build/command.py", line 258, in do_cli
    ctx.run()
  File "/home/runner/work/_temp/setup-sam-ccGfbF/.venv/lib/python3.10/site-packages/samcli/commands/build/build_context.py", line 284, in run
    self._build_result = builder.build()
  File "/home/runner/work/_temp/setup-sam-ccGfbF/.venv/lib/python3.10/site-packages/samcli/lib/build/app_builder.py", line 226, in build
    return ApplicationBuildResult(build_graph, build_strategy.build())
  File "/home/runner/work/_temp/setup-sam-ccGfbF/.venv/lib/python3.10/site-packages/samcli/lib/build/build_strategy.py", line 83, in build
    result.update(self._build_functions(self._build_graph))
  File "/home/runner/work/_temp/setup-sam-ccGfbF/.venv/lib/python3.10/site-packages/samcli/lib/build/build_strategy.py", line 93, in _build_functions
    function_build_results.update(self.build_single_function_definition(build_definition))
  File "/home/runner/work/_temp/setup-sam-ccGfbF/.venv/lib/python3.10/site-packages/samcli/lib/build/build_strategy.py", line 167, in build_single_function_definition
    result = self._build_function(
  File "/home/runner/work/_temp/setup-sam-ccGfbF/.venv/lib/python3.10/site-packages/samcli/lib/build/app_builder.py", line 738, in _build_function
    return self._build_function_in_process(
  File "/home/runner/work/_temp/setup-sam-ccGfbF/.venv/lib/python3.10/site-packages/samcli/lib/build/app_builder.py", line 892, in _build_function_in_process
    builder.build(
  File "/home/runner/work/_temp/setup-sam-ccGfbF/.venv/lib/python3.10/site-packages/aws_lambda_builders/builder.py", line 172, in build
    return workflow.run()
  File "/home/runner/work/_temp/setup-sam-ccGfbF/.venv/lib/python3.10/site-packages/aws_lambda_builders/workflow.py", line 86, in wrapper
    valid_path = binary_checker.validator.validate(executable_path)
  File "/home/runner/work/_temp/setup-sam-ccGfbF/.venv/lib/python3.10/site-packages/aws_lambda_builders/workflows/java_gradle/gradle_validator.py", line 49, in validate
    jvm_mv = self._get_major_version(gradle_path)
  File "/home/runner/work/_temp/setup-sam-ccGfbF/.venv/lib/python3.10/site-packages/aws_lambda_builders/workflows/java_gradle/gradle_validator.py", line 70, in _get_major_version
    version = m.group(1).split(".")

Steps to reproduce:

i won't share my config, guess the error tell all you need.

Observed result:

BAD, waste of time, friday evening debug

Expected result:

GOOD, 6 minutes deploy and friday's beer.

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

github actions

dkphm commented 6 days ago

Hi @nikitasius , thank you for reporting the issue. From the logs looks like it is due to a new version of aws_lambda_builders that causing the exception. To assist further, could you help to run this command

gradle --version

and give us the output?

nikitasius commented 5 days ago

@dkphm sure (currently i force 1.129.0, usual CI/CD doesn't have SAM version specified)

    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Set up AWS Coretto 21
        uses: actions/setup-java@v4
        with:
          java-version: '21'
          distribution: 'corretto'
          architecture: x64
      - uses: actions/setup-python@v5
      - uses: aws-actions/setup-sam@v2
        with:
          version: '1.129.0'
      - uses: aws-actions/configure-aws-credentials@v4
        with:

and from logs from github actions:

java -version

openjdk version "21.0.5" 2024-10-15 LTS
OpenJDK Runtime Environment Corretto-21.0.5.11.1 (build 21.0.5+11-LTS)
OpenJDK 64-Bit Server VM Corretto-21.0.5.11.1 (build 21.0.5+11-LTS, mixed mode, sharing)

gradle -v

Welcome to Gradle 8.11!

Here are the highlights of this release:
 - Parallel load and store for Configuration Cache
 - Java compilation errors at the end of the build output
 - Consolidated report for warnings and deprecations

For more details see https://docs.gradle.org/8.11/release-notes.html

------------------------------------------------------------
Gradle 8.11
------------------------------------------------------------

Build time:    2024-11-11 13:58:01 UTC
Revision:      b2ef976169a05b3c76d04f0fa76a940859f96fa4

Kotlin:        2.0.20
Groovy:        3.0.22
Ant:           Apache Ant(TM) version 1.10.14 compiled on August 16 2023
Launcher JVM:  21.0.5 (Amazon.com Inc. 21.0.5+11-LTS)
Daemon JVM:    /opt/hostedtoolcache/Java_Corretto_jdk/21.0.5-11.1/x64 (no JDK specified, using current Java home)
OS:            Linux 6.5.0-1025-azure amd64