amplify-category-api
amplify-category-api copied to clipboard
Deployment failure in CFN: `The following resource(s) failed to create: [amplifyDataProfileNestedStackProfileNestedStackResourceB5430B89]`
How did you install the Amplify CLI?
No response
If applicable, what version of Node.js are you using?
No response
Amplify CLI Version
0.11.1
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.
No manual changes made
Describe the bug
I have an app whose schema is unable to deploy to CFN, the deployment rolls back without a useful error message.
Expected behavior
The deployment should succeed.
Reproduction steps
Clone the repo and install dependencies:
git clone https://github.com/johnpc/amplify-demo-data-type-infinite
cd amplify-demo-data-type-infinite
npm install
Run the sandbox deployment:
npx amplify sandbox
Intermittently (and strangely, it may depend on the AWS account) the deployment will fail when starting from zero (all resources destroyed).
The error in the Cloudformation console shows:
Embedded stack arn:aws:cloudformation:us-west-2:566092841021:stack/amplify-dfmueaydqaxlo-pr14-branch-a7281b577b-data7552DF31-1JSVQR8U424A8/f4783232-cac5-11ee-8186-0aa259bf7d4b was not successfully created: The following resource(s) failed to create: [amplifyDataProfileNestedStackProfileNestedStackResourceB5430B89].
The issue seems most likely to occur on a freshly created AWS accounts, although I've been seeing it on older AWS accounts as well.
Project Identifier
No response
Log output
# Put your logs below this line
Additional information
No response
Before submitting, please confirm:
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.
codegen does not generate input types, but its needed for offline support. We will have to update the codegen to generate input types to make it easier to support offline support
@yuth could the input types generated by AppSync be downloaded with something like amplify api pull --types
?
@jkeys-ecg-nmsu the compiled schema should already be available to you inside <proj-root>/amplify/backedn/api/<api-name>/build/schema.json
and should have the input type.
I have added this issue to our backlog to generate input types. I will try to get to this as soon as this gets prioritized.
It seams that you can pass the entire schema into the "inputType":
import schemaGraphQL from "../../../../../amplify/backend/api/[project name]/build/schema.graphql"
then:
makePost() {
return (async () => {
const result = await this.$apollo.provider.defaultClient.mutate(
buildMutation(
this.$apollo.provider.defaultClient,
gql(require("@/graphql/mutations.js").createPost),
{
inputType: schemaGraphQL,
variables: {
input: {
title: "My post",
content: "This is the post",
}
}
},
_variables => [gql(require("@/graphql/queries.js").listPosts)],
"listPosts",
"CreatePostInput",
"id",
"AUTO"
)
);
console.log(result);
})();
},
And Im using the graphql-tag/loader: https://github.com/apollographql/graphql-tag
It seams not to work with the schema.json file...
I'm not sure if this is a good idea or not? But the goal must be to define everything once in schema.graphql and reuse everything from there on.
Set input type manually as follows. It works.
inputType: gql(`input CreateTodoInput {
id: ID
name: String!
}`),
Hi @timrchavez .The input types are generated for typescript
and flow
targets during amplify codegen add
workflow. Would be awesome if you could take advantage of those in the meantime.