I wanted to create node16 container image for aws lambda. I have following Dockerfile and index.js for lambda function. Building image (docker build -t lambda-hello-world .) works fine but when I invoke( docker run --rm -p 8080:8080 lambda-hello-world ) lambda function it returns error. Could someone please suggest?
2022-05-07T15:56:51.182Z undefined INFO Executing 'index.handler' in function directory '/'
/node_modules/aws-lambda-ric/lib/index.js:42
throw new Error("Missing Runtime API Server configuration.");
^
Error: Missing Runtime API Server configuration.
at Object.run (/node_modules/aws-lambda-ric/lib/index.js:42:15)
at Object.<anonymous> (/node_modules/aws-lambda-ric/bin/index.js:14:8)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47```
enter code here
Dockerfile
FROM node:16-alpine
# Bundle app source
COPY . .
RUN npm install
EXPOSE 8080
ENTRYPOINT ["npx", "aws-lambda-ric"]
CMD ["index.handler"]
index.js
exports.handler = async (event, context) => {
return `Hello World form node version ${process.version}`;
}