Hello,
I am using Amplify from 4years and started using Amplify Gen 2 in my new project.
In Amplify Gen2, unlike Amplify Gen 1, We need to configure the ENV variables for function with defineFunction
, like
// amplify/function/my-func/resource.ts
export const myFunc = defineFunction({
name: "apiCall",
environment: {
aws_appsync_authenticationType: "API_KEY",
aws_appsync_region: "{$myRegion}",
aws_appsync_apiKey: "xxxxxxxxxx",
aws_appsync_graphqlEndpoint:
"https://xxxxxxxxxxxxxxx.appsync-api.us-west-2.amazonaws.com/graphql",
},
});
How can i get these AWS_APPSYNC variables associated with the amplify app, from ${projectRoot}/awsconfiguration.json or we can get it from amplify backend or something without manually configuring the values each time i change my environment/branch.