amplify-category-api icon indicating copy to clipboard operation
amplify-category-api copied to clipboard

Adding Table names from cdk-construct to Appsync environment variables

Open jimjiminyjimjim opened this issue 1 year ago • 1 comments

Amplify CLI Version

@aws-amplify/graphql-api-construct v1.1.2

Question

I'm trying to add the generated table names from the cdk construct to the appsync api as environment variables so that I can reference them in my pipeline resolvers for batch requests.

Something like this: amplifyApi.resources.cfnResources.cfnGraphqlApi.environmentVariables = { TABLENAME: amplifyApi.resources.tables["Table"].tableName };

causes circular dependencies. As there doesn't seem to be an equivalent like this:

api.addEnvironmentVariable('EnvKey2', 'non-empty-2');

to add them after the tables / api has been created. Is there a better way to do this?

jimjiminyjimjim avatar Aug 16 '24 09:08 jimjiminyjimjim