Missing Runtime API Server configuration Error while deploying to docker
vigneshtdev opened this issue · 9 comments
Here's my docker file
FROM node:14.16.0-buster as build-image
# Include global arg in this stage of the build
# Install aws-lambda-cpp build dependencies
RUN apt-get update && \
apt-get install -y \
g++ \
make \
cmake \
unzip \
libcurl4-openssl-dev
RUN apt-get install -y libwoff1 \
libopus0 \
libwebp6 \
libwebpdemux2 \
libenchant1c2a \
libgudev-1.0-0 \
libsecret-1-0 \
libhyphen0 \
libgdk-pixbuf2.0-0 \
libegl1 \
libnotify4 \
libxslt1.1 \
libevent-2.1-6 \
libgles2 \
libgl1 \
libvpx5 \
# for chromium
libnss3 \
libxss1 \
libasound2 \
# for firefox
libdbus-glib-1-2 \
libxt6
COPY app.js package.json /var/task/
WORKDIR /var/task
RUN npm install
ENTRYPOINT ["/usr/local/bin/npx", "aws-lambda-ric"]
CMD [ "app.handler" ]
app.js
"use strict";
const { firefox } = require('playwright-firefox');
const run = async () => {
const browser = await firefox.launch({headless: true},);
console.log(browser.version);
const page = await browser.newPage();
await page.goto('https://google.com/');
//new S3().upload(await page.screenshot({ path: `example.png` }));
await browser.close();
}
exports.handler = async (event, context) => {
console.log(event);
console.log(process.platform);
await run();
return "Success";
};
Hey @vigneshtdev - I believe you are referring to local testing of the RIC not working and this would be because of a missing Runtime API Server when you're trying to run the function. For local testing scenarios, I'd recommend having a look at the AWS Documentation on Testing Lambda container images locally with the Runtime Interface Emulator.
Does the image run successfully when invoked within Lambda?
I wonder if someone can understand Runtime - Runtime API - Runtime API Emulator - RIC - etc combination
AWS Lambda very easy to understand in promo but very hard to work :(
Im trying to test very simple task last three days. Without AWS Lambda I can do this in a few minutes.
@carlzogh Maybe you can give me a peace of advice how to do this shortly?
@vigneshtdev @carlzogh @alexey2baranov anybody managed to solve this? Facing the same problem
@umarta85 no :(
@alexey2baranov Sad to hear that..
Facing the same issue
I just hit this too. Looking at the code, it appears that it is expected for you to define an environment variable called "AWS_LAMBDA_RUNTIME_API" for the npm library:
aws-lambda-nodejs-runtime-interface-client/src/index.ts
Lines 28 to 30 in c31c41f
These lines have been in the code for over 2 years, yet the examples in the README don't show this value being set in either the Dockerfile or specified in the example for running the image locally, so perhaps those instructions need an update.
This env var is mentioned on the following page for "Using AWS Lambda environment variables" as meaning "The host and port of the runtime API":
https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html
I haven't quite figured out what the expectation is here, but will update if I figure something out...
These examples helped me a lot: