Skip to content

sam local start-api fails to move /var/rapid/aws-lambda-rie-x86_64 in docker image for serverless function #3891

@llacroix

Description

@llacroix

Description:

Accessing a lambda using a custom docker image with python awslambdaric fails with:

samcli.commands.local.cli_common.user_exceptions.ImageBuildException: Error building docker image: The command '/bin/sh -c mv /var/rapid/aws-lambda-rie-x86_64 /var/rapid/aws-lambda-rie && chmod +x /var/rapid/aws-lambda-rie' returned a non-zero code: 1

Steps to reproduce:

Create a serverless function with a custom docker image that uses awslambdaric try to access it through an HttpApi locally.

Observed result:

Invoking Container created from httphandler:latest
Image was not found.
Removing rapid images for repo httphandler
Building image..............
Failed to build Docker Image
NoneType: None
Exception on / [GET]
Traceback (most recent call last):
  File "flask/app.py", line 2447, in wsgi_app
  File "flask/app.py", line 1952, in full_dispatch_request
  File "flask/app.py", line 1821, in handle_user_exception
  File "flask/_compat.py", line 39, in reraise
  File "flask/app.py", line 1950, in full_dispatch_request
  File "flask/app.py", line 1936, in dispatch_request
  File "samcli/local/apigw/local_apigw_service.py", line 357, in _request_handler
  File "samcli/commands/local/lib/local_lambda.py", line 144, in invoke
  File "samcli/lib/telemetry/metric.py", line 230, in wrapped_func
  File "samcli/local/lambdafn/runtime.py", line 177, in invoke
  File "samcli/local/lambdafn/runtime.py", line 88, in create
  File "samcli/local/docker/lambda_container.py", line 94, in __init__
  File "samcli/local/docker/lambda_container.py", line 236, in _get_image
  File "samcli/local/docker/lambda_image.py", line 164, in build
  File "samcli/local/docker/lambda_image.py", line 278, in _build_image
samcli.commands.local.cli_common.user_exceptions.ImageBuildException: Error building docker image: The command '/bin/sh -c mv /var/rapid/aws-lambda-rie-x86_64 /var/rapid/aws-lambda-rie && chmod +x /var/rapid/aws-lambda-rie' returned a non-zero code: 1
2022-05-19 01:01:55 127.0.0.1 - - [19/May/2022 01:01:55] "GET / HTTP/1.1" 502 -

Expected result:

Should just work or tell how to fix the issue with moving rapid/aws-lambda-rie

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

  1. OS: Fedora
  2. sam --version: 1.50.0
  3. AWS region: us-east-1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions