How to add GrapahQL End point in Lambda function, with Amplify Gen 2

0

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.

ram
asked 25 days ago98 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions