I also get this output I can't figure out why: ```...
# help
a
I also get this output I can't figure out why:
Copy code
stacks/AuthStack.js (58,23): Object is possibly 'undefined'.
56.       UserPoolId: auth.userPoolId,
57.       IdentityPoolId: auth.cdk.cfnIdentityPool.ref,
58.       UserPoolClientId: auth.cdk.userPoolClient.userPoolClientId,
I tried to migrate this with the migration guide, which told me to move cognitoCfnIdentityPool ⇒ cdk.cfnIdentityPool
You can't see it in my snippet above, but it's highlighting line 57 as problematic
n
Depends on your usecase for it, i was just outputting it so did the following 😅
Copy code
this.addOutputs({
      Region: scope.region,
      UserPoolId: this.auth.cdk.userPool.userPoolId,
      IdentityPoolId: this.auth.cdk.cfnIdentityPool?.ref || '',
      UserPoolClientId: this.auth.cdk.userPoolClient.userPoolClientId,
    });
a
Yeah, suppressing the output with your approach works great, but it turns out that it's not actually empty at all anyway
I guess the warning is because the framework can't really decide at that point if it's going to be empty or not
f
Thanks @Noah D!
Hey @Adrian Schweizer for JS code, we actually run a “type check” on build to warn about mismatched types (like in TypeScript).
When u call addOutputs, it’s expected that the output value needs to be a string, but
auth.cdk.cfnIdentityPool.ref
could be undefined, so the type check complained.
That said, I think @thdxr might’ve relaxed the type checking rule to not complain about this case. @thdxr can you confirm?