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

Permission denied when trying to run function #428

Closed
BenAychh opened this issue May 22, 2018 · 4 comments
Closed

Permission denied when trying to run function #428

BenAychh opened this issue May 22, 2018 · 4 comments
Labels
blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale.

Comments

@BenAychh
Copy link

Whenever I run sam local invoke Hello <<< "{}" or sam local start-api -d 5858 and try to invoke my function, I am getting the following stack trace.

Steps to reproduce the issue:

  1. I am using this repo here: https://github.com/BenAychh/school-ticket-sales-api-discovery
  2. sam local invoke Hello <<< "{}"

Observed result:

~/SchoolTicketSales/service-discovery >>> sam local invoke Hello <<< "{}"                                                                                                                                ±[master]
2018-05-22 17:26:46 Reading invoke payload from stdin (you can also pass it from file with --event)
2018-05-22 17:26:46 Invoking com.serverless.Handler (java8)
2018-05-22 17:26:46 Found credentials in shared credentials file: ~/.aws/credentials
2018-05-22 17:26:46 Decompressing /home/ben/SchoolTicketSales/service-discovery/target/hello-dev.jar

Fetching lambci/lambda:java8 Docker container image......
2018-05-22 17:26:48 Mounting /tmp/tmpzDMLCv as /var/task:ro inside runtime container
Traceback (most recent call last):
  File "/home/ben/.local/bin/sam", line 11, in <module>
    load_entry_point('aws-sam-cli==0.3.0', 'console_scripts', 'sam')()
  File "/home/ben/.local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/ben/.local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/ben/.local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ben/.local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ben/.local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ben/.local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/ben/.local/lib/python2.7/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/home/ben/.local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/ben/.local/lib/python2.7/site-packages/samcli/commands/local/invoke/cli.py", line 44, in cli
    docker_network, log_file, skip_pull_image, profile)  # pragma: no cover
  File "/home/ben/.local/lib/python2.7/site-packages/samcli/commands/local/invoke/cli.py", line 76, in do_cli
    stderr=context.stderr)
  File "/home/ben/.local/lib/python2.7/site-packages/samcli/commands/local/lib/local_lambda.py", line 80, in invoke
    stdout=stdout, stderr=stderr)
  File "/home/ben/.local/lib/python2.7/site-packages/samcli/local/lambdafn/runtime.py", line 83, in invoke
    self._container_manager.run(container)
  File "/home/ben/.local/lib/python2.7/site-packages/samcli/local/docker/manager.py", line 63, in run
    container.start(input_data=input_data)
  File "/home/ben/.local/lib/python2.7/site-packages/samcli/local/docker/container.py", line 167, in start
    real_container.start()
  File "/home/ben/.local/lib/python2.7/site-packages/docker/models/containers.py", line 374, in start
    return self.client.api.start(self.id, **kwargs)
  File "/home/ben/.local/lib/python2.7/site-packages/docker/utils/decorators.py", line 19, in wrapped
    return f(self, resource_id, *args, **kwargs)
  File "/home/ben/.local/lib/python2.7/site-packages/docker/api/container.py", line 1063, in start
    self._raise_for_status(res)
  File "/home/ben/.local/lib/python2.7/site-packages/docker/api/client.py", line 227, in _raise_for_status
    raise create_api_error_from_http_exception(e)
  File "/home/ben/.local/lib/python2.7/site-packages/docker/errors.py", line 31, in create_api_error_from_http_exception
    raise cls(e, response=response, explanation=explanation)
docker.errors.APIError: 400 Client Error: Bad Request ("OCI runtime create failed: container_linux.go:348: starting container process caused "chdir to cwd (\"/var/task\") set in config.json failed: permission denied": unknown")

Expected result:
The function to run.

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

Manjaro Linux
Docker version 18.04.0-ce, build 3d479c0af6

docker containers (I assume are being run)
lambci/lambda latest 6ad25a1b8bf1 10 days ago 968MB
lambci/lambda java8 674182a5353c 10 days ago 940MB

Output of sam --version:

SAM CLI, version 0.3.0

Optional Debug logs:

Add --debug flag to command you are running

@BrianFarnhill
Copy link

I'm seeing the exact same output for a .net core 2.0 function that I am trying to execute. Here is the debug enabled output I am seeing:

computer:OctankPOCSetup root# cat event.json | sam local invoke CustomSetup --debug
2018-05-29 12:11:51 local invoke command is called
2018-05-29 12:11:51 Reading invoke payload from stdin (you can also pass it from file with --event)
2018-05-29 12:11:51 1 resources found in the template
2018-05-29 12:11:51 Found Serverless function with name='CustomSetup' and CodeUri='bin/Release/netcoreapp2.0/OctankPOCSetup.zip'
2018-05-29 12:11:51 Trying paths: ['/Users/brfarn/.docker/config.json', '/Users/brfarn/.dockercfg']
2018-05-29 12:11:51 Found file at path: /Users/brfarn/.docker/config.json
2018-05-29 12:11:51 Found 'auths' section
2018-05-29 12:11:51 Auth data for https://index.docker.io/v1/ is absent. Client might be using a credentials store instead.
2018-05-29 12:11:51 Found 'credsStore' section
2018-05-29 12:11:51 http://localhost:None "GET /v1.35/_ping HTTP/1.1" 200 2
2018-05-29 12:11:51 Trying paths: ['/Users/brfarn/.docker/config.json', '/Users/brfarn/.dockercfg']
2018-05-29 12:11:51 Found file at path: /Users/brfarn/.docker/config.json
2018-05-29 12:11:51 Found 'auths' section
2018-05-29 12:11:51 Auth data for https://index.docker.io/v1/ is absent. Client might be using a credentials store instead.
2018-05-29 12:11:51 Found 'credsStore' section
2018-05-29 12:11:51 Found one Lambda function with name 'CustomSetup'
2018-05-29 12:11:51 Invoking OctankPOCSetup::OctankPOCSetup.Function::FunctionHandler (dotnetcore2.0)
2018-05-29 12:11:51 No environment variables found for function 'CustomSetup'
2018-05-29 12:11:51 Environment variables overrides data is standard format
2018-05-29 12:11:51 Loading AWS credentials from session with profile 'None'
2018-05-29 12:11:51 Loading variable profile from defaults.
2018-05-29 12:11:51 Loading variable config_file from defaults.
2018-05-29 12:11:51 Loading variable credentials_file from defaults.
2018-05-29 12:11:51 Loading variable data_path from defaults.
2018-05-29 12:11:51 Loading variable profile from defaults.
2018-05-29 12:11:51 Loading variable credentials_file from defaults.
2018-05-29 12:11:51 Loading variable config_file from defaults.
2018-05-29 12:11:51 Loading variable profile from defaults.
2018-05-29 12:11:51 Loading variable metadata_service_timeout from defaults.
2018-05-29 12:11:51 Loading variable profile from defaults.
2018-05-29 12:11:51 Loading variable metadata_service_num_attempts from defaults.
2018-05-29 12:11:51 Loading variable profile from defaults.
2018-05-29 12:11:51 Looking for credentials via: env
2018-05-29 12:11:51 Looking for credentials via: assume-role
2018-05-29 12:11:51 Looking for credentials via: shared-credentials-file
2018-05-29 12:11:51 Found credentials in shared credentials file: ~/.aws/credentials
2018-05-29 12:11:51 Loading variable profile from defaults.
2018-05-29 12:11:51 Loading variable profile from defaults.
2018-05-29 12:11:51 Loading variable region from config file with value 'ap-southeast-2'.
2018-05-29 12:11:51 Loading variable profile from defaults.
2018-05-29 12:11:51 Loading variable profile from defaults.
2018-05-29 12:11:51 Loading variable region from config file with value 'ap-southeast-2'.
2018-05-29 12:11:51 Loading variable profile from defaults.
2018-05-29 12:11:51 Loading variable profile from defaults.
2018-05-29 12:11:51 Loading variable region from config file with value 'ap-southeast-2'.
2018-05-29 12:11:51 Resolving code path. Cwd=/Users/brfarn/Repos/Octank-POC/functions/OctankPOCSetup/src/OctankPOCSetup, CodeUri=bin/Release/netcoreapp2.0/OctankPOCSetup.zip
2018-05-29 12:11:51 Resolved absolute path to code is /Users/brfarn/Repos/Octank-POC/functions/OctankPOCSetup/src/OctankPOCSetup/bin/Release/netcoreapp2.0/OctankPOCSetup.zip
2018-05-29 12:11:51 Decompressing /Users/brfarn/Repos/Octank-POC/functions/OctankPOCSetup/src/OctankPOCSetup/bin/Release/netcoreapp2.0/OctankPOCSetup.zip
2018-05-29 12:11:51 Trying paths: ['/Users/brfarn/.docker/config.json', '/Users/brfarn/.dockercfg']
2018-05-29 12:11:51 Found file at path: /Users/brfarn/.docker/config.json
2018-05-29 12:11:51 Found 'auths' section
2018-05-29 12:11:51 Auth data for https://index.docker.io/v1/ is absent. Client might be using a credentials store instead.
2018-05-29 12:11:51 Found 'credsStore' section
2018-05-29 12:11:51 http://localhost:None "GET /v1.35/images/lambci/lambda:dotnetcore2.0/json HTTP/1.1" 200 None
2018-05-29 12:11:51 Looking for auth config
2018-05-29 12:11:51 Using credentials store "osxkeychain"
2018-05-29 12:11:51 Looking for auth entry for 'https://index.docker.io/v1/'
2018-05-29 12:11:51 Found auth config
2018-05-29 12:11:54 http://localhost:None "POST /v1.35/images/create?tag=dotnetcore2.0&fromImage=lambci%2Flambda HTTP/1.1" 200 None

Fetching lambci/lambda:dotnetcore2.0 Docker container image......
2018-05-29 12:11:54 Mounting /private/tmp/tmp0dH8gL as /var/task:ro inside runtime container
2018-05-29 12:11:54 http://localhost:None "POST /v1.35/containers/create HTTP/1.1" 201 90
2018-05-29 12:11:54 http://localhost:None "GET /v1.35/containers/2ee0d4bd06b0a4f8ad0e47f89eeec9afea500ec7d28214e49a300a79fe244bff/json HTTP/1.1" 200 None
2018-05-29 12:11:54 http://localhost:None "GET /v1.35/containers/2ee0d4bd06b0a4f8ad0e47f89eeec9afea500ec7d28214e49a300a79fe244bff/json HTTP/1.1" 200 None
2018-05-29 12:11:55 http://localhost:None "POST /v1.35/containers/2ee0d4bd06b0a4f8ad0e47f89eeec9afea500ec7d28214e49a300a79fe244bff/start HTTP/1.1" 400 190
2018-05-29 12:11:55 http://localhost:None "GET /v1.35/containers/2ee0d4bd06b0a4f8ad0e47f89eeec9afea500ec7d28214e49a300a79fe244bff/json HTTP/1.1" 200 None
2018-05-29 12:11:55 http://localhost:None "DELETE /v1.35/containers/2ee0d4bd06b0a4f8ad0e47f89eeec9afea500ec7d28214e49a300a79fe244bff?force=True&link=False&v=False HTTP/1.1" 204 0
Traceback (most recent call last):
  File "/Users/brfarn/.pyenv/versions/2.7.14/bin/sam", line 11, in <module>
sys.exit(cli())
  File "/Users/brfarn/.pyenv/versions/2.7.14/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Users/brfarn/.pyenv/versions/2.7.14/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Users/brfarn/.pyenv/versions/2.7.14/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/brfarn/.pyenv/versions/2.7.14/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/brfarn/.pyenv/versions/2.7.14/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/brfarn/.pyenv/versions/2.7.14/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/Users/brfarn/.pyenv/versions/2.7.14/lib/python2.7/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/Users/brfarn/.pyenv/versions/2.7.14/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/Users/brfarn/.pyenv/versions/2.7.14/lib/python2.7/site-packages/samcli/commands/local/invoke/cli.py", line 44, in cli
    docker_network, log_file, skip_pull_image, profile)  # pragma: no cover
  File "/Users/brfarn/.pyenv/versions/2.7.14/lib/python2.7/site-packages/samcli/commands/local/invoke/cli.py", line 76, in do_cli
    stderr=context.stderr)
  File "/Users/brfarn/.pyenv/versions/2.7.14/lib/python2.7/site-packages/samcli/commands/local/lib/local_lambda.py", line 80, in invoke
    stdout=stdout, stderr=stderr)
  File "/Users/brfarn/.pyenv/versions/2.7.14/lib/python2.7/site-packages/samcli/local/lambdafn/runtime.py", line 83, in invoke
    self._container_manager.run(container)
  File "/Users/brfarn/.pyenv/versions/2.7.14/lib/python2.7/site-packages/samcli/local/docker/manager.py", line 63, in run
    container.start(input_data=input_data)
  File "/Users/brfarn/.pyenv/versions/2.7.14/lib/python2.7/site-packages/samcli/local/docker/container.py", line 167, in start
    real_container.start()
  File "/Users/brfarn/.pyenv/versions/2.7.14/lib/python2.7/site-packages/docker/models/containers.py", line 374, in start
    return self.client.api.start(self.id, **kwargs)
  File "/Users/brfarn/.pyenv/versions/2.7.14/lib/python2.7/site-packages/docker/utils/decorators.py", line 19, in wrapped
    return f(self, resource_id, *args, **kwargs)
  File "/Users/brfarn/.pyenv/versions/2.7.14/lib/python2.7/site-packages/docker/api/container.py", line 1063, in start
    self._raise_for_status(res)
  File "/Users/brfarn/.pyenv/versions/2.7.14/lib/python2.7/site-packages/docker/api/client.py", line 227, in _raise_for_status
    raise create_api_error_from_http_exception(e)
  File "/Users/brfarn/.pyenv/versions/2.7.14/lib/python2.7/site-packages/docker/errors.py", line 31, in create_api_error_from_http_exception
    raise cls(e, response=response, explanation=explanation)
docker.errors.APIError: 400 Client Error: Bad Request ("OCI runtime create failed: container_linux.go:348: starting container process caused "chdir to cwd (\"/var/task\") set in config.json failed: permission denied": unknown")

@jfuss
Copy link
Contributor

jfuss commented May 29, 2018

@BrianFarnhill Your issue is related to #389. You can find details are workarounds there.

@BenAychh Do you also have your code in a zip? Can you provide debug logs? Looking at the error, it seems like you may have your CodeUri in a zip and if you do, this issue is a duplicate of #389

@jfuss jfuss added the blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale. label May 29, 2018
@BenAychh
Copy link
Author

BenAychh commented Jun 2, 2018

Not in a zip but it is in a fat jar.

Here is the output when running debug:

sam local invoke Hello <<< "{}" --debug                                                                                                                     
2018-06-02 12:31:43 local invoke command is called
2018-06-02 12:31:43 Reading invoke payload from stdin (you can also pass it from file with --event)
2018-06-02 12:31:43 4 resources found in the template
2018-06-02 12:31:43 Found Serverless function with name='Hello' and CodeUri='target/hello-dev.jar'
2018-06-02 12:31:43 Trying paths: ['/home/ben/.docker/config.json', '/home/ben/.dockercfg']
2018-06-02 12:31:43 No config file found
2018-06-02 12:31:43 Trying paths: ['/home/ben/.docker/config.json', '/home/ben/.dockercfg']
2018-06-02 12:31:43 No config file found
2018-06-02 12:31:43 http://localhost:None "GET /v1.35/_ping HTTP/1.1" 200 2
2018-06-02 12:31:43 Trying paths: ['/home/ben/.docker/config.json', '/home/ben/.dockercfg']
2018-06-02 12:31:43 No config file found
2018-06-02 12:31:43 Trying paths: ['/home/ben/.docker/config.json', '/home/ben/.dockercfg']
2018-06-02 12:31:43 No config file found
2018-06-02 12:31:43 Found one Lambda function with name 'Hello'
2018-06-02 12:31:43 Invoking com.serverless.Handler (java8)
2018-06-02 12:31:43 No environment variables found for function 'Hello'
2018-06-02 12:31:43 Environment variables overrides data is standard format
2018-06-02 12:31:43 Loading AWS credentials from session with profile 'None'
2018-06-02 12:31:43 Loading variable profile from defaults.
2018-06-02 12:31:43 Loading variable config_file from defaults.
2018-06-02 12:31:43 Loading variable credentials_file from defaults.
2018-06-02 12:31:43 Loading variable data_path from defaults.
2018-06-02 12:31:43 Loading variable profile from defaults.
2018-06-02 12:31:43 Loading variable credentials_file from defaults.
2018-06-02 12:31:43 Loading variable config_file from defaults.
2018-06-02 12:31:43 Loading variable profile from defaults.
2018-06-02 12:31:43 Loading variable metadata_service_timeout from defaults.
2018-06-02 12:31:43 Loading variable profile from defaults.
2018-06-02 12:31:43 Loading variable metadata_service_num_attempts from defaults.
2018-06-02 12:31:43 Loading variable profile from defaults.
2018-06-02 12:31:43 Looking for credentials via: env
2018-06-02 12:31:43 Looking for credentials via: assume-role
2018-06-02 12:31:43 Looking for credentials via: shared-credentials-file
2018-06-02 12:31:43 Found credentials in shared credentials file: ~/.aws/credentials
2018-06-02 12:31:43 Loading variable profile from defaults.
2018-06-02 12:31:43 Loading variable profile from defaults.
2018-06-02 12:31:43 Loading variable region from config file with value 'us-east-1'.
2018-06-02 12:31:43 Loading variable profile from defaults.
2018-06-02 12:31:43 Loading variable profile from defaults.
2018-06-02 12:31:43 Loading variable region from config file with value 'us-east-1'.
2018-06-02 12:31:43 Loading variable profile from defaults.
2018-06-02 12:31:43 Loading variable profile from defaults.
2018-06-02 12:31:43 Loading variable region from config file with value 'us-east-1'.
2018-06-02 12:31:43 Resolving code path. Cwd=/home/ben/SchoolTicketSales/service-discovery, CodeUri=target/hello-dev.jar
2018-06-02 12:31:43 Resolved absolute path to code is /home/ben/SchoolTicketSales/service-discovery/target/hello-dev.jar
2018-06-02 12:31:43 Decompressing /home/ben/SchoolTicketSales/service-discovery/target/hello-dev.jar
2018-06-02 12:31:44 Trying paths: ['/home/ben/.docker/config.json', '/home/ben/.dockercfg']
2018-06-02 12:31:44 No config file found
2018-06-02 12:31:44 Trying paths: ['/home/ben/.docker/config.json', '/home/ben/.dockercfg']
2018-06-02 12:31:44 No config file found
2018-06-02 12:31:44 http://localhost:None "GET /v1.35/images/lambci/lambda:java8/json HTTP/1.1" 200 None
2018-06-02 12:31:44 Looking for auth config
2018-06-02 12:31:44 No auth config in memory - loading from filesystem
2018-06-02 12:31:44 Trying paths: ['/home/ben/.docker/config.json', '/home/ben/.dockercfg']
2018-06-02 12:31:44 No config file found
2018-06-02 12:31:44 Looking for auth entry for 'docker.io'
2018-06-02 12:31:44 No entry found
2018-06-02 12:31:44 No auth config found
2018-06-02 12:31:44 http://localhost:None "POST /v1.35/images/create?tag=java8&fromImage=lambci%2Flambda HTTP/1.1" 200 None

Fetching lambci/lambda:java8 Docker container image......
2018-06-02 12:31:44 Mounting /tmp/tmpl_FaXT as /var/task:ro inside runtime container
2018-06-02 12:31:45 http://localhost:None "POST /v1.35/containers/create HTTP/1.1" 201 90
2018-06-02 12:31:45 http://localhost:None "GET /v1.35/containers/0a8894b8a8c437e1e4ead33b9bb68ab3df3d8507b71aada777edc289db67c9e8/json HTTP/1.1" 200 None
2018-06-02 12:31:45 http://localhost:None "GET /v1.35/containers/0a8894b8a8c437e1e4ead33b9bb68ab3df3d8507b71aada777edc289db67c9e8/json HTTP/1.1" 200 None
2018-06-02 12:31:45 http://localhost:None "POST /v1.35/containers/0a8894b8a8c437e1e4ead33b9bb68ab3df3d8507b71aada777edc289db67c9e8/start HTTP/1.1" 400 190
2018-06-02 12:31:45 http://localhost:None "GET /v1.35/containers/0a8894b8a8c437e1e4ead33b9bb68ab3df3d8507b71aada777edc289db67c9e8/json HTTP/1.1" 200 None
2018-06-02 12:31:45 http://localhost:None "DELETE /v1.35/containers/0a8894b8a8c437e1e4ead33b9bb68ab3df3d8507b71aada777edc289db67c9e8?force=True&link=False&v=False HTTP/1.1" 204 0
Traceback (most recent call last):
  File "/home/ben/.local/bin/sam", line 11, in <module>
    load_entry_point('aws-sam-cli==0.3.0', 'console_scripts', 'sam')()
  File "/home/ben/.local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/ben/.local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/ben/.local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ben/.local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ben/.local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ben/.local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/ben/.local/lib/python2.7/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/home/ben/.local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/ben/.local/lib/python2.7/site-packages/samcli/commands/local/invoke/cli.py", line 44, in cli
    docker_network, log_file, skip_pull_image, profile)  # pragma: no cover
  File "/home/ben/.local/lib/python2.7/site-packages/samcli/commands/local/invoke/cli.py", line 76, in do_cli
    stderr=context.stderr)
  File "/home/ben/.local/lib/python2.7/site-packages/samcli/commands/local/lib/local_lambda.py", line 80, in invoke
    stdout=stdout, stderr=stderr)
  File "/home/ben/.local/lib/python2.7/site-packages/samcli/local/lambdafn/runtime.py", line 83, in invoke
    self._container_manager.run(container)
  File "/home/ben/.local/lib/python2.7/site-packages/samcli/local/docker/manager.py", line 63, in run
    container.start(input_data=input_data)
  File "/home/ben/.local/lib/python2.7/site-packages/samcli/local/docker/container.py", line 167, in start
    real_container.start()
  File "/home/ben/.local/lib/python2.7/site-packages/docker/models/containers.py", line 374, in start
    return self.client.api.start(self.id, **kwargs)
  File "/home/ben/.local/lib/python2.7/site-packages/docker/utils/decorators.py", line 19, in wrapped
    return f(self, resource_id, *args, **kwargs)
  File "/home/ben/.local/lib/python2.7/site-packages/docker/api/container.py", line 1063, in start
    self._raise_for_status(res)
  File "/home/ben/.local/lib/python2.7/site-packages/docker/api/client.py", line 227, in _raise_for_status
    raise create_api_error_from_http_exception(e)
  File "/home/ben/.local/lib/python2.7/site-packages/docker/errors.py", line 31, in create_api_error_from_http_exception
    raise cls(e, response=response, explanation=explanation)
docker.errors.APIError: 400 Client Error: Bad Request ("OCI runtime create failed: container_linux.go:348: starting container process caused "chdir to cwd (\"/var/task\") set in config.json failed: permission denied": unknown")

@sanathkr
Copy link
Contributor

sanathkr commented Jun 6, 2018

Fixes and integration tests are in #464. Closing this one as dupe of #389. Follow that issue for updates.

@sanathkr sanathkr closed this as completed Jun 6, 2018
mndeveci added a commit that referenced this issue Nov 14, 2022
* # This is a combination of 2 commits.
# This is the 1st commit message:

Add dotnet7 build method for provided

* Added 'BuildMethod: dotnet7' using 'Runtime:provided'
* 'Runtime:provided' is only for the provided runtime and not the dotnet runtime

Testing with sample SAM template:
 ( See BuildMethod and Runtime below )
...
  HelloWorldFunction:
    Type: AWS::Serverless::Function
    Metadata:
      BuildMethod: dotnet7
    Properties:
      CodeUri: ./src/HelloWorld/
      Handler: HelloWorld::HelloWorld.Function::FunctionHandler
      Runtime: provided
      Architectures:
        - x86_64
...

# This is the commit message #2:

Add dotnet7 build method for provided

* Added 'BuildMethod: dotnet7' using 'Runtime:provided'
* 'Runtime:provided' is only for the provided runtime and not the dotnet runtime

Testing with sample SAM template:
 ( See BuildMethod and Runtime below )
...
  HelloWorldFunction:
    Type: AWS::Serverless::Function
    Metadata:
      BuildMethod: dotnet7
    Properties:
      CodeUri: ./src/HelloWorld/
      Handler: HelloWorld::HelloWorld.Function::FunctionHandler
      Runtime: provided
      Architectures:
        - x86_64
...

* run black reformat

Co-authored-by: Samiullah Mohammed <[email protected]>
Co-authored-by: Wing Fung Lau <[email protected]>
Co-authored-by: Mehmet Nuri Deveci <[email protected]>
mndeveci added a commit that referenced this issue Nov 15, 2022
* feat: add dotnet7 build method (#428)

* # This is a combination of 2 commits.
# This is the 1st commit message:

Add dotnet7 build method for provided

* Added 'BuildMethod: dotnet7' using 'Runtime:provided'
* 'Runtime:provided' is only for the provided runtime and not the dotnet runtime

Testing with sample SAM template:
 ( See BuildMethod and Runtime below )
...
  HelloWorldFunction:
    Type: AWS::Serverless::Function
    Metadata:
      BuildMethod: dotnet7
    Properties:
      CodeUri: ./src/HelloWorld/
      Handler: HelloWorld::HelloWorld.Function::FunctionHandler
      Runtime: provided
      Architectures:
        - x86_64
...

# This is the commit message #2:

Add dotnet7 build method for provided

* Added 'BuildMethod: dotnet7' using 'Runtime:provided'
* 'Runtime:provided' is only for the provided runtime and not the dotnet runtime

Testing with sample SAM template:
 ( See BuildMethod and Runtime below )
...
  HelloWorldFunction:
    Type: AWS::Serverless::Function
    Metadata:
      BuildMethod: dotnet7
    Properties:
      CodeUri: ./src/HelloWorld/
      Handler: HelloWorld::HelloWorld.Function::FunctionHandler
      Runtime: provided
      Architectures:
        - x86_64
...

* run black reformat

Co-authored-by: Samiullah Mohammed <[email protected]>
Co-authored-by: Wing Fung Lau <[email protected]>
Co-authored-by: Mehmet Nuri Deveci <[email protected]>

* update provided with provided.al2

* Update test_build_cmd.py

* Update test_workflow_config.py

* Update aws-lambda-tools-defaults.json

Co-authored-by: Beau Gosse <[email protected]>
Co-authored-by: Samiullah Mohammed <[email protected]>
Co-authored-by: Wing Fung Lau <[email protected]>
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

4 participants