https://serverless-stack.com/ logo
#sst
Title
# sst
m

Mike McCall

04/12/2021, 3:46 PM
^ seems to be working now. blew up node_modules.
f

Frank

04/12/2021, 5:39 PM
hey @Mike McCall did u get it to work?
m

Mike McCall

04/12/2021, 5:44 PM
Yeah, reading deeper in the error it was mismatched types (same type reference 🤷‍♂️ ). I deleted the entire node modules dir and did a reinstall. It seems like a version mismatch, but the versions were the same…
f

Frank

04/12/2021, 5:47 PM
Can you share a snippet of the error?
m

Mike McCall

04/12/2021, 5:49 PM
I do not have the exact error anymore but it was close to this: https://github.com/aws/aws-cdk/issues/8211
types of parameter are incompatible.
f

Frank

04/12/2021, 5:50 PM
Do you remember if the error comes from the CDK code or SST code?
m

Mike McCall

04/12/2021, 5:51 PM
Sorry I’m not being much help at this point… So the message saying it expected IUserPool instead of UserPool was from sst. But I THINK that was a bit misleading because the incompatible parameter types from cdk.
f

Frank

04/12/2021, 5:53 PM
Got it. My hunch is that you have the
aws-cognito
dependency in your package.json, and you are using it to import the userpool. And
sst.AppSyncApi
also has a
aws-cognito
module in its package.json. And depending on how npm installs them, there could be 2 different instances of
aws-cognito
in your node_modules.
And doing a fresh install usually solves that.
m

Mike McCall

04/12/2021, 5:54 PM
Yup, it’s also using yarn workspaces.
BTW is there a good way to see what version sst expects?
f

Frank

04/12/2021, 5:55 PM
In this case, they are probably of the same version. Your node_modules probably looked like:
Copy code
node_modules/
  @aws-cdk/
    aws-cognito v1.94.1
  @serverless-stack
    @aws-cdk/
      aws-cognito v1.94.1
If the user pool is created using 1
aws-cognito
import, and then the other
aws-cognito
try to check its type, it results in an type error
m

Mike McCall

04/12/2021, 5:58 PM
ahh ok
f

Frank

04/12/2021, 5:58 PM
But yeah to answer your question, SST will print out a warning if there is a version mismatch with the version that is mismatched.
This type of issues will be resolved in CDK v2. SST will be able to include
aws-cdk
as a peerDependency. So there should never be multiple instances of the same CDK classes in your node_modules.
m

Mike McCall

04/12/2021, 6:00 PM
sweet, cdk is moving monolith structure (like sst)
f

Frank

04/12/2021, 6:01 PM
yup yup!