aws-amplify / aws-amplify/amplify-cli

Set a lambda environment variable to JSON

Open
#9,605 2 comments 0 reactions 0 assignees View on GitHub
feature-request functions p3
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### Is this feature request related to a new or existing Amplify category?

_No response_

### Is this related to another service?

Lambda

### Describe the feature you'd like to request

I am currently working on implementing the Google Cloud NodeJS package into an Amplify lambda function and the restrictions that you find with setting an environment variable for a lambda function using the CLI is preventing me from setting the variable to a longer JSON file value. Inside the AWS Console I can set it to the JSON value but it will be overwritten every time I push my Amplify resources.

The function is used to validate a Google Enterprise reCAPTCHA and requires the use of a service account to access the Google Cloud.

### Describe the solution you'd like

I would like to be able to set an Amplify lambda environment variable to a larger JSON value so that I can let the Google Cloud package see it when trying to access process.env.GOOGLE_APPLICATION_CREDENTIALS.

### Describe alternatives you've considered

I have considered using a bash script before running the lambda but it might not work because the Node environment is already set up so setting up the environment variable at runtime would be useless.

### Additional context

_No response_

### Is this something that you'd be interested in working on?

- [ ] 👋 I may be able to implement this feature request
- [ ] ⚠️ This feature might incur a breaking change

Contributor guide

Open the contributing guide

Research direction

No file or test is named. Start by tracing the Amplify CLI's Lambda environment-variable handling and compare its value limits with the AWS Console; done means a larger JSON value survives CLI pushes and is available through process.env.GOOGLE_APPLICATION_CREDENTIALS.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, google-cloud, nodejs, typescript
Domain
backend, cli, cloud
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.