lambci / docker-lambda

Docker images and test runners that replicate the live AWS Lambda environment
MIT License
5.83k stars 431 forks source link

Fix Node v4.3 entrypoint #202

Closed bshackelford closed 5 years ago

bshackelford commented 5 years ago

Context

I'm having issues running node in the Node v4.3 Docker image:

Fetching lambci/lambda:nodejs4.3 Docker container image......
2019-07-26 12:33:23 Mounting <PATH> as /var/task:ro,delegated inside runtime container
Traceback (most recent call last):
  File "/usr/local/bin/sam", line 10, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/usr/local/lib/python2.7/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 56, in cli
    parameter_overrides)  # pragma: no cover
  File "/usr/local/lib/python2.7/site-packages/samcli/commands/local/invoke/cli.py", line 100, in do_cli
    stderr=context.stderr)
  File "/usr/local/lib/python2.7/site-packages/samcli/commands/local/lib/local_lambda.py", line 93, in invoke
    self.local_runtime.invoke(config, event, debug_context=self.debug_context, stdout=stdout, stderr=stderr)
  File "/usr/local/lib/python2.7/site-packages/samcli/local/lambdafn/runtime.py", line 86, in invoke
    self._container_manager.run(container)
  File "/usr/local/lib/python2.7/site-packages/samcli/local/docker/manager.py", line 98, in run
    container.start(input_data=input_data)
  File "/usr/local/lib/python2.7/site-packages/samcli/local/docker/container.py", line 189, in start
    real_container.start()
  File "/usr/local/lib/python2.7/site-packages/docker/models/containers.py", line 392, in start
    return self.client.api.start(self.id, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/docker/utils/decorators.py", line 19, in wrapped
    return f(self, resource_id, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/docker/api/container.py", line 1091, in start
    self._raise_for_status(res)
  File "/usr/local/lib/python2.7/site-packages/docker/api/client.py", line 263, 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: 400 Client Error: Bad Request ("OCI runtime create failed: container_linux.go:344: starting container process caused "exec: \"/usr/local/lib64/node-v4.3.x/bin/node\": stat /usr/local/lib64/node-v4.3.x/bin/node: no such file or directory": unknown")

Issue

/usr/local/lib64/node-v4.3.x/bin/node doesn't exist. node is found @ /var/lang/bin/node instead.

Open Questions

I still see references to /usr/local/lib64/node-v4.3.x/bin/node in base/dump-nodejs43.js. Is there a proper way to update?

cc. @mhart

mhart commented 5 years ago

Oh yeah, nice find – I hadn't checked the 4.3 image since they updated the Lambda OS.

This looks good to me – I'll play around with it a bit just to double check 👍

mhart commented 5 years ago

Gonna merge and then fix up any remaining comments – will let you know when the latest image has been pushed

bshackelford commented 5 years ago

Thanks @mhart 🙏

mhart commented 5 years ago

Done! Thanks so much for the contribution!