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

500 error when running offline #451

Closed
KoldBrewEd opened this issue May 31, 2018 · 2 comments
Closed

500 error when running offline #451

KoldBrewEd opened this issue May 31, 2018 · 2 comments

Comments

@KoldBrewEd
Copy link
Contributor

I had version 0.10 installed and managed to run offline just fine:

> sam local invoke HelloWorldFunction
2018/05/31 15:54:22 Successfully parsed template.yaml (version 2010-09-09)
2018/05/31 15:54:22 Connected to Docker 1.37
2018/05/31 15:54:22 Fetching lambci/lambda:nodejs6.10 image for nodejs6.10 runtime...
2018/05/31 15:54:22 Could not fetch lambci/lambda:nodejs6.10 Docker image: Error response from daemon: Get https://registry-1.docker.io/v2/: Service Unavailable
2018/05/31 15:54:22 Reading invoke payload from stdin (you can also pass it from file with --event)
{}

2018/05/31 15:54:31 Invoking index.handler (nodejs6.10)
START RequestId: 06dfc3cb-191e-1376-5e38-98aba4421439 Version: $LATEST
2018-05-31T05:54:32.334Z	06dfc3cb-191e-1376-5e38-98aba4421439	Loading function
END RequestId: 06dfc3cb-191e-1376-5e38-98aba4421439
REPORT RequestId: 06dfc3cb-191e-1376-5e38-98aba4421439	Duration: 46.60 ms	Billed Duration: 100 ms	Memory Size: 128 MB	Max Memory Used: 29 MB

"Hello World!"

Upgraded to 0.30 and now I get the error:

> sam local invoke HelloWorldFunction
2018-05-31 15:55:26 Reading invoke payload from stdin (you can also pass it from file with --event)
{}
2018-05-31 15:55:33 Invoking index.handler (nodejs6.10)
2018-05-31 15:55:33 Found credentials in environment variables.
Traceback (most recent call last):
  File "/usr/local/bin/sam", line 11, in <module>
    sys.exit(cli())
  File "/Users/edlima/Library/Python/2.7/lib/python/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Users/edlima/Library/Python/2.7/lib/python/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Users/edlima/Library/Python/2.7/lib/python/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/edlima/Library/Python/2.7/lib/python/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/edlima/Library/Python/2.7/lib/python/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/edlima/Library/Python/2.7/lib/python/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/Users/edlima/Library/Python/2.7/lib/python/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/Users/edlima/Library/Python/2.7/lib/python/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/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 "/usr/local/lib/python2.7/site-packages/samcli/commands/local/invoke/cli.py", line 76, in do_cli
    stderr=context.stderr)
  File "/usr/local/lib/python2.7/site-packages/samcli/commands/local/lib/local_lambda.py", line 80, in invoke
    stdout=stdout, stderr=stderr)
  File "/usr/local/lib/python2.7/site-packages/samcli/local/lambdafn/runtime.py", line 83, in invoke
    self._container_manager.run(container)
  File "/usr/local/lib/python2.7/site-packages/samcli/local/docker/manager.py", line 53, in run
    self.pull_image(image_name)
  File "/usr/local/lib/python2.7/site-packages/samcli/local/docker/manager.py", line 83, in pull_image
    result_itr = self.docker_client.api.pull(image_name, stream=True, decode=True)
  File "/usr/local/lib/python2.7/site-packages/docker/api/image.py", line 399, in pull
    self._raise_for_status(response)
  File "/usr/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 "/usr/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: 500 Server Error: Internal Server Error ("Get https://registry-1.docker.io/v2/: Service Unavailable")

It only works with --skip-pull-image:

> sam local invoke HelloWorldFunction  --skip-pull-image2018-05-31 15:58:04 Reading invoke payload from stdin (you can also pass it from file with --event)

{}

2018-05-31 15:58:12 Invoking index.handler (nodejs6.10)
2018-05-31 15:58:12 Found credentials in environment variables.
2018-05-31 15:58:12 Requested to skip pulling images ...

2018-05-31 15:58:12 Mounting /Users/edlima/Documents/GitHub/serverless-application-model/examples/2016-10-31/hello_world/src as /var/task:ro inside runtime container
START RequestId: a3c92b1f-89a2-1387-7def-07fd2a37e3e7 Version: $LATEST
2018-05-31T05:58:13.111Z	a3c92b1f-89a2-1387-7def-07fd2a37e3e7	Loading function
END RequestId: a3c92b1f-89a2-1387-7def-07fd2a37e3e7
REPORT RequestId: a3c92b1f-89a2-1387-7def-07fd2a37e3e7	Duration: 35.46 ms	Billed Duration: 100 ms	Memory Size: 128 MB	Max Memory Used: 29 MB

"Hello World!"

The documentation is not clear. We should catch the 500 error and display a msg suggesting to use --skip-pull-image instead

@jfuss
Copy link
Contributor

jfuss commented Jun 19, 2018

@awsed Seems reasonable and a better experience in general. Updating labelss

@jfuss
Copy link
Contributor

jfuss commented Dec 27, 2018

We have addressed this in #764 and released in v0.7.0.

Closing

@jfuss jfuss closed this as completed Dec 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants