Closed KoldBrewEd closed 5 years ago
There a workaround for this. Go to backend-config.json
and under function
key find backendGraphQL
then under dependsOn => attributes
add this value GraphQLAPIEndpointOutput
. Repeat this for amplify-meta.json
file. This will allow you to access the GraphQL URL in your function CF Stack via apibackendGraphQLGraphQLAPIEndpointOutput
. Finally, you can add it to your function environment variables.
Thanks, any plans to make it part of the function creation?
@awsed Yes, we’ll add it to the defaults. I’ll update this thread after submitting a PR for the same.
@eelzinaty if I do the changes you suggested I get this:
UPDATE_ROLLBACK_COMPLETE backend-graphql-master-20190610091720 AWS::CloudFormation::Stack Mon Jun 10 2019 09:28:26 GMT-0700 (Pacific Daylight Time)
⠋ Updating resources in the cloud. This may take a few minutes...Error updating cloudformation stack
⠋ Updating resources in the cloud. This may take a few minutes...
Following resources failed
✖ An error occurred when pushing the resources to the cloud
Resource is not in the state stackUpdateComplete
If I remove GraphQLAPIEndpointOutput
the stack is deployed.
@awsed Added this is a part of PR - #1641 This enhancement would be present in the next version of the CLI.
I think the problem is related to the parameter name if you show me the error that causes the stack failure I could help to resolve that.
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help
channels for those types of questions.
Steps:
amplify add api amplify add function Select CRUD permissions to API
Description:
I'm trying to create a function that invokes an AppSync API from the backend however the AppSync URL is not passed as an environment variable. Since this use case demands the use of an HTTP client on lambda, the URL is essential. Refer to the env variables created: