AppSync: Custom stack not pushing
See original GitHub issueDescribe the bug
Using version 0.2.2-multienv.1, I have created a custom stack that adds resolvers for a mutation. I have followed the guide and used the example: https://github.com/mikeparisstuff/amplify-cli-nested-api-sample. But the stack is not being pushed when I call amplify push
To Reproduce
The custom stack (amplify/backend/myAPI/stacks/custom.json
):
{
"AWSTemplateFormatVersion":"2010-09-09",
"Description":"An auto-generated nested stack.",
"Metadata":{
},
"Parameters":{
"AppSyncApiId":{
"Type":"String",
"Description":"The id of the AppSync API associated with this project."
},
"AppSyncApiName":{
"Type":"String",
"Description":"The name of the AppSync API",
"Default":"AppSyncSimpleTransform"
},
"env":{
"Type":"String",
"Description":"The environment name. e.g. Dev, Test, or Production",
"Default":"NONE"
},
"S3DeploymentBucket":{
"Type":"String",
"Description":"The S3 bucket containing all deployment assets for the project."
},
"S3DeploymentRootKey":{
"Type":"String",
"Description":"An S3 key relative to the S3DeploymentBucket that points to the root\nof the deployment directory."
}
},
"Resources":{
"MutationAddTicketResolver":{
"Type":"AWS::AppSync::Resolver",
"Properties":{
"ApiId":{
"Ref":"AppSyncApiId"
},
"DataSourceName":"Questionnaire",
"TypeName":"Mutation",
"FieldName":"addTicket",
"RequestMappingTemplateS3Location":{
"Fn::Sub":[
"s3://${S3DeploymentBucket}/${S3DeploymentRootKey}/resolvers/Mutation.addTicket.req.vtl",
{
"S3DeploymentBucket":{
"Ref":"S3DeploymentBucket"
},
"S3DeploymentRootKey":{
"Ref":"S3DeploymentRootKey"
}
}
]
},
"ResponseMappingTemplateS3Location":{
"Fn::Sub":[
"s3://${S3DeploymentBucket}/${S3DeploymentRootKey}/resolvers/Mutation.addTicket.res.vtl",
{
"S3DeploymentBucket":{
"Ref":"S3DeploymentBucket"
},
"S3DeploymentRootKey":{
"Ref":"S3DeploymentRootKey"
}
}
]
}
}
}
},
"Conditions":{
"HasEnvironmentParameter":{
"Fn::Not":[
{
"Fn::Equals":[
{
"Ref":"env"
},
"NONE"
]
}
]
},
"AlwaysFalse":{
"Fn::Equals":[
"true",
"false"
]
}
},
"Outputs":{
"EmptyOutput":{
"Description":"An empty output. You may delete this if you have at least one resource above.",
"Value":""
}
}
}
The request resolver (amplify/backend/myAPI/resolvers/Mutation.addTicket.req.vti
):
{
"version": "2017-02-28",
"operation": "UpdateItem",
"key": { "id": { "S": "$context.args.questionnaire" } },
"update": {
"expression" : "SET #tickets = list_append(if_not_exists(#tickets, :empty), :vals)",
"expressionNames": {
"#tickets" : "tickets"
},
"expressionValues": {
":vals" : {
"L": [{
"M": {
"id": { "S": $util.autoId() },
"user": { "S": $context.args.user },
"expiresAt": { "S": $context.args.expiresAt }
}
}]
},
":empty": { "L": [] }
}
}
}
The response resolver (amplify/backend/myAPI/resolvers/Mutation.addTicket.res.vti
):
$util.toJson($context.result)
The schema:
type Ticket {
id: ID!
user: ID!
expiresAt: String!
}
type Mutation {
addTicket(expiresAt: String!, user: ID!, questionnaire: ID!): Ticket
}
Expected behavior Addition of a custom resolver for the addTicket mutation in AppSync
Desktop (please complete the following information):
- OS: OSX
- Version 10.14
Additional context This is an amplify installation that was migrated from non-multienv but has been rebuilt since (all resources re-added from scratch). The push is completing successfully, just without the stack.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
@RickCraig Custom resolvers are not supported as a part of @multienv CLI version but is now a part of the main CLI version. You can go ahead and install the v1 version of the CLI using
npm install -g @aws-amplify/cli
and let me know if you’re still seeing this issue.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.