How do I access Lambda environment variables in IoT Greengrass?

0

I have a Lambda function with a NodeJS 12.x runtime and five environment variables. When I write the output of process.env['someVar'] while testing the Lambda in the console, I can see the value of the environment variable.

When I deploy the Lambda to a Greengrass Core (version 1.10), I do not see any value returned by process.env['someVar']. Is there a different mechanism to access them? The docs suggest there is no difference. "Key-value pairs that can dynamically pass settings to function code and libraries. Local environment variables work the same way as AWS Lambda function environment variables, but are available in the core environment."

Lambda cloud log

2020-04-15T21:10:28.389Z	842e9642-8982-44cc-bb84-a7f8e9a3cdec	INFO	url http://localhost:80
2020-04-15T21:10:28.389Z	842e9642-8982-44cc-bb84-a7f8e9a3cdec	INFO	process.env INFLUXDB_URL http://localhost:80

Lambda greengrass log

[2020-04-15T21:02:10.817Z][INFO]-url
[2020-04-15T21:02:10.817Z][INFO]-process.env INFLUXDB_URL

What am I missing?

AWS
Ryan_B
질문됨 4년 전418회 조회
1개 답변
0
수락된 답변

The Lambda environment variables don't carry over, you need to add the environment variables to the "Group-specific Lambda configuration" in the AWS IoT Greengrass console.

https://docs.aws.amazon.com/greengrass/latest/developerguide/lambda-group-config.html

AWS
답변함 4년 전
profile picture
전문가
검토됨 한 달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠