amplify-cli: `GRAPHQLAPIIDOUTPUT` and `GRAPHQLAPIENDPOINTOUTPUT` are not set
Describe the bug
GRAPHQLAPIIDOUTPUT
and GRAPHQLAPIENDPOINTOUTPUT
are not set
Amplify CLI Version 4.18.0
To Reproduce
amplify function update
? Please select the Lambda Function you would want to update
functionname
? Do you want to update permissions granted to this Lambda function to perform on other resources in your project?
Yes
? Select the category
api, storage
? Api has n resources in this project. Select the one you would like your Lambda to access
apiname
? Select the operations you want to permit for apiname
read
? Storage has n resources in this project. Select the one you would like your Lambda to access
storagename
? Select the operations you want to permit for storagename
read, update
? Do you want to invoke this function on a recurring schedule?
No
? Do you want to edit the local lambda function now?
No
- print env value
console.log(process.env.API_APINAME_GRAPHQLAPIIDOUTPUT);
console.log(process.env.API_APINAME_GRAPHQLAPIENDPOINTOUTPUT);
console.log(process.env.STORAGE_STORAGENAME_BUCKETNAME);
Expected behavior
console.log(process.env.API_APINAME_GRAPHQLAPIIDOUTPUT);
-> "abcdef..."
console.log(process.env.API_APINAME_GRAPHQLAPIENDPOINTOUTPUT);
-> "https://abcdef....appsync-api.[region].amazonaws.com/graphql"
console.log(process.env.STORAGE_STORAGENAME_BUCKETNAME);
-> "storagename-env"
Actual behavior
console.log(process.env.API_APINAME_GRAPHQLAPIIDOUTPUT);
-> "apiapinameGraphQLAPIIdOutput"
console.log(process.env.API_APINAME_GRAPHQLAPIENDPOINTOUTPUT);
-> "apiapinameGraphQLAPIEndpointOutput"
console.log(process.env.STORAGE_STORAGENAME_BUCKETNAME);
-> "storagename-env"
Desktop (please complete the following information):
- OS: [Ubuntu]
- Node Version: [v12.14.1]
Additional context
amplify function update
and attach dynamodb table occured below error.
Currently in UPDATE_ROLLBACK_IN_PROGRESS with reason: No export named apiapinameGraphQLAPIIdOutput:GetAtt:FooTable:Name found
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 20 (3 by maintainers)
@edwardfoyle I’m getting the same error with Amplify CLI Version 4.18.1. When I run
amplify mock
it’s returned:Could not find ref for "apideliveringHopeApiGraphQLAPIIdOutput". Using unsubstituted value. Could not find ref for "apideliveringHopeApiGraphQLAPIEndpointOutput". Using unsubstituted value.
I added the function using the command
amplify add function
.This is the content of the root stack CFN file:
I just ran onto this too … tried adding auth. See the values but the path is pathname: ‘apiassetAPIGraphQLAPIEndpointOutput’ },
I was going so fast until I hit DynamoDB, pivoted to GraphQL and I’m almost equally sad.
Follow up on a behavior I noticed. If you start off with Cognito User pools, and then pivot to IAM or apiKey for say a Lambda to write to DynamoDB – it seems to re-arrange the default auth as opposed to add other available auth types. I was able to thankfully diff recent changes across many files and notice my block of auth types changed. So this of course can break the frontend. I’ve swapped my work to making smaller incremental changes so I don’t get in a bind. I also had cases where if a S3 Trigger had a policy and then I added another policy for DynamoDB or GraphQL the policy names collided resulting in a circular dependency. I just had to go in and prefix these policy names so they wouldn’t conflict.
I was facing a similar issue when adding/updating a function to the cloud.
On a new project I tried to grant permissions to API and Auth resources like this:
As you can see, I had the same friendly name for the API and Auth resources.
When pushing the function I got the message: Template format error: Unresolved resource dependencies [authrevampxpUserPoolId] in the Resources block of the template
The function env variables were: API_REVAMPXP_GRAPHQLAPIENDPOINTOUTPUT - Correctly set API_REVAMPXP_GRAPHQLAPIIDOUTPUT - Correctly set AUTH_REVAMPXP_USERPOOLID - Set with default value
Then I started a new project with exactly the same configuration and model. I just let the Auth resource name generated by the cli. So that this name be different than the API resource name.
I added a new function:
And it worked. No errors in the console, and env variables correctly set in the function.
So do you have resources with the same name?