sst / ion

❍ — a new engine for SST
https://ion.sst.dev
MIT License
1.11k stars 132 forks source link

CongitoUserPool does not update successfully on deploy #617

Open joshwils82 opened 1 week ago

joshwils82 commented 1 week ago

When adding a sst.aws.CognitoUserPool, the sst deploy will run successfully on the first deploy but fail on an update with the following error.

Error       TestPool sst:aws:CognitoUserPool → TestPoolUserPool aws:cognito:UserPool
|  updating
urn:pulumi:jwilson::test::sst:aws:CognitoUserPool$aws:cognito/userPool:UserPool::TestPoolUserPool: 1
error occurred:
|
|  updating Cognito User Pool (us-east-1_StGlwm27q): cannot modify or remove schema items

here is an example sst.config.ts

/// <reference path="./.sst/platform/config.d.ts" />

export default $config({
  app(input) {
    return {
      name: "test",
      removal: input?.stage === "production" ? "retain" : "remove",
      home: "aws",
    };
  },
  async run() {
     new sst.aws.CognitoUserPool('TestPool', {})
   // new aws.cognito.UserPool("PPool", {name: "mypool"}, {ignoreChanges: ["schemas"]})
  },
});

Please note that the same error occurs with the pulumi aws.cognito.UserPool resource but it can be worked around by adding the ignoreChanges: ["schemas"] option. Currently, the sst construct does not pass the options to the pulumi resource so this work around does not work for sst.

My suggestion would be to support the options on the sst construct as it will likely be useful in other cases as well.

sst ion version: 0.0.473

goto3 commented 5 days ago

I am also having this issue

jayair commented 3 days ago

Oh interesting. Thanks for the pointer.

hauerm commented 3 days ago

In my case it turned out, that I created the CognitoUserPool and afterwards modified some configuration of it which affected already created schema attributes. This does not work by design in a Cognito User Pool. My solution was to remove and recreate the CognitoUserPool. Be careful with the attributes.