question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Removing @searchable from a model fails to update stack

See original GitHub issue

Describe 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:

  1. Edit an existing graphql schema that has @searchable on one of its models to remove @searchable
  2. 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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
kstro21commented, Mar 14, 2019

@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:

  1. Add @searchable to a model in the schema.graphql
  2. Run amplify push
  3. Remove @searchable from a model in the schema.graphql
  4. Export i198123kjaskdh912:GetAtt:TodoTable:StreamArn cannot be deleted as it is in use by amplifytest-20190308140619-apiamplifytest-Q5YW46Y7U507-SearchableStack-3Y7BNSAD6DKM

Expected behavior I expect to be able to remove @searchable from a model.

Desktop (please complete the following information):

  • amplify 1.1.7

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.

image

The solution is to always export the table’s StreamArn, not only when the @searchable directive is used. This is already requested in #987

2reactions
mikeparisstuffcommented, Mar 7, 2019

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Update CloudFormation stacks that are failing because ... - AWS
If you delete a resource that was created by a CloudFormation stack, then your stack fails to update, and you get an error...
Read more >
update-stack — AWS CLI 2.9.8 Command Reference
To remove all currently specified triggers, specify an empty list for this parameter. If a specified trigger is missing, the entire stack operation...
Read more >
when using laravel scout, searchable() isn't updating related ...
I am having an issue getting related models to update with scout elastic search. $event->priceranges()->delete(); ...
Read more >
Delete API | Elasticsearch Guide [8.5] | Elastic
If an external versioning variant is used, the delete operation automatically creates the specified index if it does not exist.
Read more >
Removing Errors on CloudFormation Stack Creation - Stelligent
If that update fails, the stack has a valid state to roll back to. Creating an empty stack. The CloudFormation template below uses...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found