aws-sam-cli: RC1 failing local invoke for Node12.

Description

sam local invoke fails for nodejs12 project with following error:

    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: http+docker://localhost/v1.35/containers/b750d7791ae2d2b1ab5b57a27a0b50f8379e170e06e9205c9ab150827f69fcea/start

Steps to reproduce

  1. sam init a node12 project.
  2. sam local invoke in that project.

Observed result

❯ sam local invoke --debug                                                                                                                                                               ─╯
Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
local invoke command is called
No Parameters detected in the template
2 resources found in the template
Found Serverless function with name='HelloWorldFunction' and CodeUri='HelloWorldFunction'
Found one Lambda function with name 'HelloWorldFunction'
Invoking app.lambdaHandler (nodejs12.x)
No environment variables found for function 'HelloWorldFunction'
Environment variables overrides data is standard format
Loading AWS credentials from session with profile 'None'
Resolving code path. Cwd=/Users/tarumall/workplace/byol-testbed/sam-app-n12/.aws-sam/build, CodeUri=HelloWorldFunction
Resolved absolute path to code is /Users/tarumall/workplace/byol-testbed/sam-app-n12/.aws-sam/build/HelloWorldFunction
Code /Users/tarumall/workplace/byol-testbed/sam-app-n12/.aws-sam/build/HelloWorldFunction is not a zip/jar file
Skipping building an image since no layers were defined

Fetching amazon/aws-sam-cli-emulation-image-nodejs12.x:latest Docker container image......
Mounting /Users/tarumall/workplace/byol-testbed/sam-app-n12/.aws-sam/build/HelloWorldFunction as /var/task:ro,delegated inside runtime container
Sending Telemetry: {'metrics': [{'commandRun': {'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam local invoke', 'duration': 1565, 'exitReason': 'APIError', 'exitCode': 255, 'requestId': 'dc38f743-a36c-417f-a3a4-b10902e605b1', 'installationId': '2b7af8d7-cfbd-4d71-baa7-3dfc0f010bbe', 'sessionId': '72e9043d-9e17-4974-a387-431d2a80ad28', 'executionEnvironment': 'CLI', 'pyversion': '3.7.7', 'samcliVersion': '1.0.0rc1'}}]}
Telemetry response: 200
Traceback (most recent call last):
  File "/usr/local/Cellar/aws-sam-cli-rc/1.0.0rc1/libexec/lib/python3.7/site-packages/docker/api/client.py", line 261, in _raise_for_status
    response.raise_for_status()
  File "/usr/local/Cellar/aws-sam-cli-rc/1.0.0rc1/libexec/lib/python3.7/site-packages/requests/models.py", line 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: http+docker://localhost/v1.35/containers/8d47e54ddafcc6815d508126c6b260591a9cf2107a9fa7ae391b34d643288bfe/start

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/sam", line 33, in <module>
    sys.exit(load_entry_point('aws-sam-cli==1.0.0rc1', 'console_scripts', 'sam')())
  File "/usr/local/Cellar/aws-sam-cli-rc/1.0.0rc1/libexec/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/Cellar/aws-sam-cli-rc/1.0.0rc1/libexec/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/Cellar/aws-sam-cli-rc/1.0.0rc1/libexec/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/Cellar/aws-sam-cli-rc/1.0.0rc1/libexec/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/Cellar/aws-sam-cli-rc/1.0.0rc1/libexec/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/Cellar/aws-sam-cli-rc/1.0.0rc1/libexec/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/Cellar/aws-sam-cli-rc/1.0.0rc1/libexec/lib/python3.7/site-packages/click/decorators.py", line 73, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/Cellar/aws-sam-cli-rc/1.0.0rc1/libexec/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/Cellar/aws-sam-cli-rc/1.0.0rc1/libexec/lib/python3.7/site-packages/samcli/lib/telemetry/metrics.py", line 96, in wrapped
    raise exception  # pylint: disable=raising-bad-type
  File "/usr/local/Cellar/aws-sam-cli-rc/1.0.0rc1/libexec/lib/python3.7/site-packages/samcli/lib/telemetry/metrics.py", line 62, in wrapped
    return_value = func(*args, **kwargs)
  File "/usr/local/Cellar/aws-sam-cli-rc/1.0.0rc1/libexec/lib/python3.7/site-packages/samcli/commands/local/invoke/cli.py", line 86, in cli
    parameter_overrides,
  File "/usr/local/Cellar/aws-sam-cli-rc/1.0.0rc1/libexec/lib/python3.7/site-packages/samcli/commands/local/invoke/cli.py", line 151, in do_cli
    context.function_name, event=event_data, stdout=context.stdout, stderr=context.stderr
  File "/usr/local/Cellar/aws-sam-cli-rc/1.0.0rc1/libexec/lib/python3.7/site-packages/samcli/commands/local/lib/local_lambda.py", line 100, in invoke
    self.local_runtime.invoke(config, event, debug_context=self.debug_context, stdout=stdout, stderr=stderr)
  File "/usr/local/Cellar/aws-sam-cli-rc/1.0.0rc1/libexec/lib/python3.7/site-packages/samcli/local/lambdafn/runtime.py", line 83, in invoke
    self._container_manager.run(container)
  File "/usr/local/Cellar/aws-sam-cli-rc/1.0.0rc1/libexec/lib/python3.7/site-packages/samcli/local/docker/manager.py", line 95, in run
    container.start(input_data=input_data)
  File "/usr/local/Cellar/aws-sam-cli-rc/1.0.0rc1/libexec/lib/python3.7/site-packages/samcli/local/docker/container.py", line 188, in start
    real_container.start()
  File "/usr/local/Cellar/aws-sam-cli-rc/1.0.0rc1/libexec/lib/python3.7/site-packages/docker/models/containers.py", line 400, in start
    return self.client.api.start(self.id, **kwargs)
  File "/usr/local/Cellar/aws-sam-cli-rc/1.0.0rc1/libexec/lib/python3.7/site-packages/docker/utils/decorators.py", line 19, in wrapped
    return f(self, resource_id, *args, **kwargs)
  File "/usr/local/Cellar/aws-sam-cli-rc/1.0.0rc1/libexec/lib/python3.7/site-packages/docker/api/container.py", line 1095, in start
    self._raise_for_status(res)
  File "/usr/local/Cellar/aws-sam-cli-rc/1.0.0rc1/libexec/lib/python3.7/site-packages/docker/api/client.py", line 263, in _raise_for_status
    raise create_api_error_from_http_exception(e)
  File "/usr/local/Cellar/aws-sam-cli-rc/1.0.0rc1/libexec/lib/python3.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: 500 Server Error: Internal Server Error ("b'Mounts denied: \r\nThe path /usr/local/Cellar/aws-sam-cli-rc/1.0.0rc1/libexec/lib/python3.7/site-packages/samcli/local/rapid\r\nis not shared from OS X and is not known to Docker.\r\nYou can configure shared paths from Docker -> Preferences... -> File Sharing.\r\nSee https://docs.docker.com/docker-for-mac/osxfs/#namespaces for more info.\r\n.'")

Expected result

Describe what you expected.

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

  1. OS: macOS Catalina
  2. sam --version: SAM CLI, version 1.0.0rc1

Add --debug flag to command you are running

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 25 (7 by maintainers)

Most upvoted comments

Me too, I’m getting the message on function invocations…

Failed to download a new amazon/aws-sam-cli-emulation-image-nodejs12.x:rapid-1.0.0 image. Invoking with 
the already downloaded image.

Using various quick start templates for nodejs12.x

same issue SAM CLI, version 1.10.0

Error: Could not find amazon/aws-sam-cli-emulation-image-nodejs12.x:rapid-1.10.0 image locally and failed to pull it from docker.