Removing @searchable from a model fails to update stack
See original GitHub issueDescribe the bug
$ amplify --version 1.1.7
This looks a lot like #794 but since that is closed I’m opening a new bug since it could be different.
I am trying to remove @searchable from a model. All I did was delete @searchable and then tried to do amplify push
to make the cloud changes but it fails.
A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior:
- Edit an existing graphql schema that has @searchable on one of its models to remove @searchable
- run
amplify push
Errors start showing up around GraphQLAPIKey
UPDATE_FAILED GraphQLAPIKey AWS::AppSync::ApiKey Tue Mar 05 2019 15:23:07 GMT-0800 (Pacific Standard Time) API key not found: da2-s7usndw5ybcn5i6zcrwvxlnwcu (Service: AWSAppSync; Status Code: 404; Error Code: NotFoundException; Request ID: a1b04564-3f9d-11e9-a1a8-a39b785176a3)
UPDATE_ROLLBACK_IN_PROGRESS spark-20190218123525-apispark-CR4WIE34F814 AWS::CloudFormation::Stack Tue Mar 05 2019 15:23:09 GMT-0800 (Pacific Standard Time) The following resource(s) failed to update: [GraphQLAPIKey].
Final error messages after rollback:
Following resources failed
Resource Name: arn:aws:appsync:us-west-2:665143778343:apis/mijd5doyovfplaohn26st7kk5e/apikeys/da2-s7usndw5ybcn5i6zcrwvxlnwcu (AWS::AppSync::ApiKey)
Event Type: update
Reason: API key not found: da2-s7usndw5ybcn5i6zcrwvxlnwcu (Service: AWSAppSync; Status Code: 404; Error Code: NotFoundException; Request ID: a1b04564-3f9d-11e9-a1a8-a39b785176a3)
URL: https://console.aws.amazon.com/cloudformation/home?region=us-west-2#/stacks/arn%3Aaws%3Acloudformation%3Aus-west-2%3A665143778343%3Astack%2Fspark-20190218123525-apispark-CR4WIE34F814%2F0699df30-353f-11e9-a0a1-0a9edf17d014/events
Expected behavior The command should complete and the model is no longer searchable and elastic search resources have been de-provisioned.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: MacOS 10.14.3
- Browser Safari 12.0.3
- Amplify CLI version 1.1.7. Note this was originally happening in 1.1.0 but I installed 1.1.7 to see if it was fixed as #794 indicated.
Additional context Add any other context about the problem here.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:11 (4 by maintainers)
Top GitHub Comments
@mikeparisstuff I’m commenting here to describe my experience with the same issue in order to avoid opening a new one.
Describe the bug I tried to remove the @searchable directive from a model, but it is not possible using amplify.
To Reproduce Steps to reproduce the behavior:
amplify push
Expected behavior I expect to be able to remove @searchable from a model.
Desktop (please complete the following information):
Additional context The problem is that the table’s StreamArn is only exported if the @searchable directive is added to the model. So, removing it cause the exported value to be removed, but, the
"AWS::CloudFormation::Stack"
that creates the"AWS::Elasticsearch::Domain"
"DependsOn"
the model, thus the stack containing the model will be updated first and fails.The solution is to always export the table’s StreamArn, not only when the @searchable directive is used. This is already requested in #987
@poppybank I am looking into this issue. The reason for the error is that the new stack is removing an export in one of the model stacks that is now unnecessary because searchable is being removied. The issue is that the searchable resources depend on the model stack (because the streaming depends on the model table) causing the model stack to get updated first. Since the existing searchable stack still depends on the export that is now gone, the update fails. You should be able to sidestep the issue by removing your API’s SearchableStack using the AWS CloudFormation console and then running push again without the searchable directive. Meanwhile, I will continue investigating and try to figure out a solution to this moving forward.