Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
320 views
in Technique[技术] by (71.8m points)

amazon web services - Setting AWS env variables in Firebase cloud functions

I'm using the AWS SDK in order to store images for my app. I'm using Firebase cloud functions rather than setting up my own server.

The AWS SDK is clever in that it can automatically detect environmental variables for connecting to an S3 instance: https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-environment.html

The SDK automatically detects AWS credentials set as variables in your environment and uses them for SDK requests, eliminating the need to manage credentials in your application. The environment variables that you set to provide your credentials are:

AWS_ACCESS_KEY_ID

AWS_SECRET_ACCESS_KEY

AWS_SESSION_TOKEN (optional)

However, in Firebase, all environmental variables must be lowercase. https://firebase.google.com/docs/functions/config-env

Keep in mind that only lowercase characters are accepted in keys; uppercase characters are not allowed.

Is there any solution to setting AWS environmental variables in Firebase functions?

question from:https://stackoverflow.com/questions/65834958/setting-aws-env-variables-in-firebase-cloud-functions

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The Firebase config you're talking about are not in any way related to process environment variables that are used by the AWS SDK. While they have similar names, they are actually completely unrelated by implementation. You simply won't be able to use the Firebase tooling to create process environment variables used by AWS.

If you want to set up process env vars in Cloud Functions, you won't even be able to establish those with the Firebase tooling. You will have to make changes to environment variables in the Google Cloud console for the functions you have already deployed.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...