Open jerocosio opened 1 year ago
Hey @jerocosio :wave: thanks for raising this! While we begin to look at this issue in more depth can you describe the CloudFormation errors you're seeing? If you visit the AWS CloudFormation console and navigate to the "Events" tab, do you see any additional information in the stack events that shed some insight?
Hey @josefaidt thank you for taking a look at this. I didn't knew about that console, but it looks like this is the error that started:
apiappAPI | CREATE_FAILED | Embedded stack arn:aws:cloudformation:us-east-2:060252099651:stack/amplify-appAPI-qa-142556-apiappAPI-145RB624HJ56I/bf1052a0-aca6-11ed-b9bb-02a4b2d59540 was not successfully created: The following resource(s) failed to create: [User]. |
---|
Is there anyway to learn more about why this was not created succesfully?
Hey @jerocosio thanks for clarifying and for posting those details! Yes, you are able to drill into the API's nested stack and view the events for that User
model. Would you also mind sharing a snippet of the User model and its relationships, indexes, etc.?
Same/similar error and can't deploy after updating to 10.7.2
🛑 The following resources failed to deploy:
Resource Name: authlivapp (AWS::CloudFormation::Stack)
Event Type: update
Reason: Parameters: [allowUnauthenticatedIdentities, identityPoolName] must have values
🛑 Resource is not in the state stackUpdateComplete
Name: authlivapp (AWS::CloudFormation::Stack), Event Type: update, Reason: Parameters: [allowUnauthenticatedIdentities, identityPoolName] must have values
I have no local pending changes and there are no changes to pull
.
Hey @josefaidt here's the user model and others that are part of the relations, I deleted a lot of the 'normal' fields as well as auth rules and try to only leave the relationships/indexes:
type User
@model
@auth(
rules: [ ...]
) {
id: ID!
email: AWSEmail!
@auth(
rules: [ ...]
)
@index(name: "usersByEmail", queryField: "usersByEmail")
owner: String!
@auth(
rules: [ ...]
)
@index(name: "userByOwner", queryField: "userByOwner")
}
I'm also getting permission to a couple of functions both to the table and to the model for GraphQL and using this code to add access to the User table on some custom VLT functions I have:
import { AmplifyApiGraphQlResourceStackTemplate } from "@aws-amplify/cli-extensibility-helper";
//This function is so that the generated AppSync resolvers have access to the correct table
export function override(resources: AmplifyApiGraphQlResourceStackTemplate) {
resources.models["User"].appsyncFunctions[
"MutationupdateUserpostAuth1FunctionMutationupdateUserpostAuth1Function.AppSyncFunction"
].dataSourceName = "UserTable";
}
Hey @luisreyes while the error is similar it appears the root cause for your issue is different. Would you mind filing a separate bug report for this occurrence?
@jerocosio thanks for sending that over! I suspect the override may be the culprit here but I will attempt to reproduce this and narrow it down 🙂
Hey @jerocosio I was able to reproduce this using the following steps:
amplify init -y
amplify add api
> GraphQLtype Todo
@model
@auth(rules: [{ allow: public, operations: [read] }, { allow: owner }]) {
id: ID!
name: String!
description: String
}
amplify override api
> copy/paste the following override
import { AmplifyApiGraphQlResourceStackTemplate } from '@aws-amplify/cli-extensibility-helper'
export function override(resources: AmplifyApiGraphQlResourceStackTemplate) {
resources.models['Todo'].appsyncFunctions[
'MutationupdateTodoauth1FunctionMutationupdateTodoauth1Function.AppSyncFunction'
].dataSourceName = 'TodoTable'
}
amplify push -y
amplify add env qa
amplify push -y
As a workaround we can comment out the override code, run amplify push -y
, then uncomment and re-push.
It's important to note I was not able to reproduce then when attempting to override the datasource for the generated auth0 resolver, but if I add another resolver Mutation.updateTodo.auth.2.req.vtl
and apply the override I am able to reproduce this consistently. Marking as a bug 🙂
Hey @josefaidt, thank you so much for looking into this, I followed the workaround and it worked great. I think it would be even better if there was an easier way to add specific resources or Tables into a resolver, as you can see right now the process sin't really straight forward and it's hard to get the right appsync function name.
I also edited my models to remove information, but just left enough in case someone's having the same issue and googling it.
Facing the same issue where we have added a CDK override to create an API gateway WAF and hence a dependency on REST API like so
// Access other Amplify Resources
const dependencies: AmplifyDependentResourcesAttributes =
AmplifyHelpers.addResourceDependency(
this,
amplifyResourceProps.category,
amplifyResourceProps.resourceName,
[{ category: 'api', resourceName: MyApi' }]
);
const apiId = cdk.Fn.ref(dependencies.api.MyApi.ApiId);
But it fails with an error where it cannot find the apiId ref.
How did you install the Amplify CLI?
yarn
If applicable, what version of Node.js are you using?
v18.13.0
Amplify CLI Version
10.7.2
What operating system are you using?
Mac
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
Added some HTML templates for sending out messages/verifications through Cognit, and also on Cognito I defined a couple of Cognito triggers.
Describe the bug
I'm trying to remove and re-create my Cognito 'add' by removing it and adding it again on my Amplify project as I want to add some fields and make 2FA optional.
What I want to do is create a test environment to make this changes and test that it works, but whenever I'm trying to create a new environment and then push it to the cloud I'm gettin this error without any other data:
On the terminal there's a ton of text, but I can see this deployment failures:
I can see that the environment gets created with no issues, but when I try to push it there, that's where I see all these issues. I've also tried doing the cloning of the project using the web UI in the console, but it has the same effect, the environment gets created, but when it tries to start creating the resources the deployment fails.
Expected behavior
To be able to create a new environment to test out new features or changes.
Reproduction steps
amplify env add qa
amplify push
Project Identifier
No response
Log output
Additional information
No response
Before submitting, please confirm: