We're seeing the error: ```Replacement type update...
# sst
r
We're seeing the error:
Copy code
Replacement type updates not supported on stack with disable-rollback.
We had to rename a table in the stack as its definition had changed, after doing so we get this error. What's the recommendation to deal with this?
f
Let me loop in @thdxr . Dax, I think this might be related to the disable rollback change for sst start.
t
You can pass in a flag to SST start
--rollback=true
f
When rollback is disabled, u can't replace resources in the stack. (Updating resource names often require a replace ie. delete and recreate)
r
cool, I'll give that a tru
try even
t
We disable by default because it's faster and 99% of the time it's fine
r
got ya
Lost our window to try this out so trying redeploy from seed and getting
Copy code
This stack is currently in a non-terminal [UPDATE_FAILED] state. To update the stack from this state, please use the disable-rollback parameter with update-stack API. To rollback to the last known good state, use the rollback-stack API
I don't see the option in the console to apply a rollback, which seems odd. Is there a way to force this via seed
?
f
Ross, if you go to the CFN console, can you rollback manually there?
m
is this error same as this ?
Copy code
CloudFormation cannot update a stack when a custom-named resource requires replacing. Rename *********** and update the stack again.
@Frank I'm trying to add new globalIndex on dynamodb table
r
No - there's no option to rollback
Previously I've seen the banner appear at the top with the options to rollback, update, etc but nothing's there this time
f
Can you try reverting the change and deploy again from local without the —rollback=true flag?
r
Great minds, actually doing just that but with rollback=false
f
@Mehmet Ali SARAÇ that might be a different issue. Were you trying to rename a global index? You’d have to remove it, deploy, add it back with the new name and then deploy again.
m
nope I didnt change the name of it. I just simply add a new global index
how could I restore the data ? @Frank
t
Are you sure you're adding a global index and not a local index?
m
Copy code
globalIndexes: {
                isApprovedIndex: {partitionKey: "is_approved", sortKey: "timestamp"},
                fromIndex: {partitionKey: "from"} // this one is new
            }
yep I did this too many times
r
@Frank - this gave me
Copy code
Replacement type updates not supported on stack with disable-rollback.
m
But this error happens after an update which secondaryIndexes deprecated
t
@Ross Coundon I think you'd need to revert to the old code, then run with rollback=true
wait actually, you can't fix this from the CFN console? I remember being stuck in this state and using that
m
aha after I change the name of the dynamodb table I got the error which @Ross Coundon gets
Copy code
Replacement type updates not supported on stack with disable-rollback.
r
It's not giving me the option to perform any changes via the console
t
There's some combination of enabling/disabling rollback + reverting code changes in a certain order that will get it back. I'm not able to remember exactly what I did though
r
Nuts - seems I'm stuck in a catch-22 Reverting to the old code and running deploy with
--rolback-true
gives
Copy code
This stack is currently in a non-terminal [UPDATE_FAILED] state. To update the stack from this state, please use the disable-rollback parameter with update-stack API. To rollback to the last known good state, use the rollback-stack API
I have to jump in the car for an hour now, will be back to fix this later
any ideas in the meantime, gratefully received!
t
old code + rollback=false didn't help either?
f
@Ross Coundon @Mehmet Ali SARAÇ Dax and I are going to jump into a meeting for 2 hrs. We can try to reproduce the issue on our end after that. If you guys figure anything out before that, keep us posted!
m
I rollback the stack and it worked.
r
How did you roll it back?
@thdxr - old code + rollback=false gives
Copy code
Replacement type updates not supported on stack with disable-rollback.
I've now run the deploy with
rollback=false
and then
rollback=true
which both failed but at least then the console allowed me to initiate a rollback which succeeded and left the stack in state UPDATE_ROLLBACK_COMPLETE So, now I'm attempting to deploy the old code via Seed...
Copy code
Status: Failed
  Error: Internal Failure
From Seed build logs
Just retried, same problem - 'internal failure'
t
is this not a local development environment? Curious why going through seed
r
We had an app that was deployed via seed. We tried to switch it to run locally to debug some changes and got into this tangle
Now we're just trying to get it back to the state it was originally
So, I ended up running
sst remove
from my own machine followed by a seed deploy which (after removing log retention settings) worked.
What would you recommend as a process to mske a change to something like the structure of a dynamodb table in terms of deployment? There might need to be some data migration in that example but what would need to be done from an SST and Seed perspective?
t
So I don't fully understand what change forced a replacement. Did you rename the literal table or the logical id?
m
I am having this issue. The problem with replacement types is that subsequent deployments do not detect changes. It essentially just ignores the update and moves on.
if you try with rollback after a fail you'll run into errors like:
Copy code
This stack is currently in a non-terminal [UPDATE_FAILED] state. To update the stack from this state, please use the disable-rollback parameter with update-stack API.
Not sure it's the best default
Basically, you need to remove, deploy, add, deploy. This is not good especially since my current issue is with an api authorizer.
r
@thdxr I missed your question when we were talking about this. For us it was the definition of the global secondary index had changed
f
@Mike McCall
… subsequent deployments do not detect changes.
I think that might be a bug with SST. I’m going to put in a change today https://github.com/serverless-stack/serverless-stack/issues/1037
This is fixed in v0.53.0.
j
@Frank upgraded to v0.53.0 and have the same issue. Changed a lambda function not a table
f
Hey guys, this is fixed in v0.53.3.
So 
sst start
 uses 
--rollback=true
 by default now. And you can set it to 
false
 to override it.