I have react web app that uses aws amplify to build its backend. This backend consists of a graphql api with a dynamodb table as data source (created by the model declared in my graphql schema) and a lambda function that fetches information from a 3rd party api and saves the results into the dynamodb table to make it available for the app.
Following this tutorial:
https://docs.amplify.aws/cli/function#graphql-from-lambda
I created the lambda function running the "amplify add function" command. I answered "yes" when I was asked if the lambda should have access to other amplify resources and I gave the lambda write and update access to my graphql api, so that I can perform mutations from the lambda.
When I finish the creation process, amplify informs me that I have two new environment variables available in the lambda:
API_<MY_APP>_GRAPHQLAPIENDPOINTOUTPUT
API_<MY_APP>_GRAPHQLAPIIDOUTPUT
The problem is, however, that I also need the api key in order to be able to perform the mutations (my graphql api has "api key" as primary id method).
The tutorial makes use of process.env.API_KEY. However they don't explain where this variable comes from, as in my case its value is undefined.
Do you know how to make the api key available to my lambda?
P.S.: Hardcoding is not an option, as I have several backend environments.