how to put variable into a string as a prefix of function in Graphql?

0

As title, we have a graphql file in amplify, and we have a need to put a variable at the start of lambda function name. e.g. type Query { grantDeviceToken(macs: [String!]!): GrantTokenResponse @function(name: "${site}-appsyncGrantDeviceToken-${env}") } As this example, is it possible to make ${site} as a variable and how do I setup the variable value?

thankshow to put variable into a string as a prefix of function in Graphql? As title, we have a graphql file in amplify, and we have a need to put a variable at the start of lambda function name. e.g.

type Query { grantDeviceToken(macs: [String!]!): GrantTokenResponse @function(name: "{site}-appsyncGrantDeviceToken-${env}") }

As this example, is it possible to make ${site} as a variable and how do I setup the variable value?

thanks

1 réponse
1

Hello, I understand that you would like to set lambda resolver name dynamically using a variable(“site”). Please note that according to the documentation the @function directive allows you to use ${env} to reference the current Amplify CLI environment.

However, I could not see any resources/documentation discussing an out of box approach to create variables which could be accessed in the GraphQL schema as mentioned by you. Having said that, please feel free to raise a feature request with the Amplify service team via the GitHub.

In case I misunderstood the query, please feel free to reach out to us via creating a support case from the support centre dashboard and elaborate your usecase in detail.

AWS
INGÉNIEUR EN ASSISTANCE TECHNIQUE
répondu il y a 2 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions