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: sam local invoke - OSError #5480

Closed
subhamsaha216 opened this issue Jul 11, 2023 · 5 comments
Closed

Bug: sam local invoke - OSError #5480

subhamsaha216 opened this issue Jul 11, 2023 · 5 comments
Labels
area/local/invoke sam local invoke command blocked/close-if-inactive Blocked for >14 days with no response, will be closed if still inactive after 7 days blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale.

Comments

@subhamsaha216
Copy link

subhamsaha216 commented Jul 11, 2023

Description:

I am trying to locally invoke a lambda at the time of building image, I'm getting this Error. Recently I upgraded aws-sam-cli, after that only this type of error I'm getting, please help me.

Steps to reproduce:

This is the command, I'm using to invoke the lambda:
sam local invoke lambda_function -e invoke/payload.json

Observed result:

Local image was not found.
Building image...
Error: [Errno 5] Input/output error
Traceback:
File "/usr/local/Cellar/aws-sam-cli/1.90.0/libexec/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/aws-sam-cli/1.90.0/libexec/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/aws-sam-cli/1.90.0/libexec/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/aws-sam-cli/1.90.0/libexec/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/aws-sam-cli/1.90.0/libexec/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/aws-sam-cli/1.90.0/libexec/lib/python3.11/site-packages/click/decorators.py", line 93, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/aws-sam-cli/1.90.0/libexec/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/aws-sam-cli/1.90.0/libexec/lib/python3.11/site-packages/samcli/lib/telemetry/metric.py", line 184, in wrapped
raise exception # pylint: disable=raising-bad-type
^^^^^^^^^^^^^^^
File "/usr/local/Cellar/aws-sam-cli/1.90.0/libexec/lib/python3.11/site-packages/samcli/lib/telemetry/metric.py", line 149, in wrapped
return_value = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/aws-sam-cli/1.90.0/libexec/lib/python3.11/site-packages/samcli/lib/utils/version_checker.py", line 42, in wrapped
actual_result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/aws-sam-cli/1.90.0/libexec/lib/python3.11/site-packages/samcli/cli/main.py", line 95, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/aws-sam-cli/1.90.0/libexec/lib/python3.11/site-packages/samcli/commands/local/invoke/cli.py", line 100, in cli
do_cli(
File "/usr/local/Cellar/aws-sam-cli/1.90.0/libexec/lib/python3.11/site-packages/samcli/commands/local/invoke/cli.py", line 206, in do_cli
context.local_lambda_runner.invoke(
File "/usr/local/Cellar/aws-sam-cli/1.90.0/libexec/lib/python3.11/site-packages/samcli/commands/local/lib/local_lambda.py", line 144, in invoke
self.local_runtime.invoke(
File "/usr/local/Cellar/aws-sam-cli/1.90.0/libexec/lib/python3.11/site-packages/samcli/lib/telemetry/metric.py", line 324, in wrapped_func
return_value = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/aws-sam-cli/1.90.0/libexec/lib/python3.11/site-packages/samcli/local/lambdafn/runtime.py", line 189, in invoke
container = self.create(function_config, debug_context, container_host, container_host_interface)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/aws-sam-cli/1.90.0/libexec/lib/python3.11/site-packages/samcli/local/lambdafn/runtime.py", line 85, in create
container = LambdaContainer(
^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/aws-sam-cli/1.90.0/libexec/lib/python3.11/site-packages/samcli/local/docker/lambda_container.py", line 94, in init
image = LambdaContainer._get_image(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/aws-sam-cli/1.90.0/libexec/lib/python3.11/site-packages/samcli/local/docker/lambda_container.py", line 237, in _get_image
return lambda_image.build(runtime, packagetype, image, layers, architecture, function_name=function_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/aws-sam-cli/1.90.0/libexec/lib/python3.11/site-packages/samcli/local/docker/lambda_image.py", line 231, in build
self._build_image(
File "/usr/local/Cellar/aws-sam-cli/1.90.0/libexec/lib/python3.11/site-packages/samcli/local/docker/lambda_image.py", line 328, in _build_image
with create_tarball(tar_paths, tar_filter=tar_filter) as tarballfile:
File "/usr/local/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/contextlib.py", line 137, in enter
return next(self.gen)
^^^^^^^^^^^^^^
File "/usr/local/Cellar/aws-sam-cli/1.90.0/libexec/lib/python3.11/site-packages/samcli/lib/utils/tar.py", line 34, in create_tarball
archive.add(path_on_system, arcname=path_in_tarball, filter=tar_filter)
File "/usr/local/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/tarfile.py", line 2179, in add
self.add(os.path.join(name, f), os.path.join(arcname, f),
File "/usr/local/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/tarfile.py", line 2179, in add
self.add(os.path.join(name, f), os.path.join(arcname, f),
File "/usr/local/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/tarfile.py", line 2179, in add
self.add(os.path.join(name, f), os.path.join(arcname, f),
[Previous line repeated 1 more time]
File "/usr/local/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/tarfile.py", line 2173, in add
self.addfile(tarinfo, f)
File "/usr/local/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/tarfile.py", line 2201, in addfile
copyfileobj(fileobj, self.fileobj, tarinfo.size, bufsize=bufsize)
File "/usr/local/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/tarfile.py", line 252, in copyfileobj
buf = src.read(bufsize)
^^^^^^^^^^^^^^^^^

Expected result:

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

  1. OS: Mac
  2. sam --version: 1.90.0
  3. AWS region: ap-south-1
{
  "version": "1.90.0",
  "system": {
    "python": "3.11.4",
    "os": "macOS-11.2.1-x86_64-i386-64bit"
  },
  "additional_dependencies": {
    "docker_engine": "20.10.17",
    "aws_cdk": "Not available",
    "terraform": "Not available"
  },
  "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"
  ]
}

@subhamsaha216 subhamsaha216 added the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label Jul 11, 2023
@hawflau
Copy link
Contributor

hawflau commented Jul 11, 2023

Hi @subhamsaha216 thanks for raising the issue.
Can you please provide a sample application to help us reproduce the error?

@hawflau hawflau added blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale. area/local/invoke sam local invoke command and removed stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Jul 11, 2023
@subhamsaha216
Copy link
Author

Hi @hawflau, can you help me with a sample template of application what you are expecting, because in which application I'm working on it's very large and confidential.

@hnnasit
Copy link
Contributor

hnnasit commented Aug 25, 2023

Hi @subhamsaha216, you can use the sam init command to generate a sample project and try to reproduce the error. Providing us with the steps to reproduce the issue will help us debug the issue further. Does the error still occur in the latest version SAM CLI 1.95.0?

@hnnasit hnnasit added the blocked/close-if-inactive Blocked for >14 days with no response, will be closed if still inactive after 7 days label Oct 20, 2023
@moelasmar
Copy link
Contributor

Closing due to inactivity, please create another issue if you still have the same problem, or any other problems.

Copy link
Contributor

github-actions bot commented Nov 3, 2023

⚠️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
area/local/invoke sam local invoke command blocked/close-if-inactive Blocked for >14 days with no response, will be closed if still inactive after 7 days 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

4 participants