Michael Wolfenden
03/29/2021, 11:36 PMConstruct
. What do I pass?
import * as sst from '@serverless-stack/resources'
import * as ssm from '@aws-cdk/aws-ssm'
export default class MyStack extends sst.Stack {
constructor(scope: <http://sst.App|sst.App>, id: string, props?: sst.StackProps) {
super(scope, id, props)
new ssm.StringParameter(
/* what do I pass here, it requires a Constuct */
)
}
Frank
this
, which is the stack construct. So this ssm resource belongs to this CloudFormation stack.
new ssm.StringParameter(this, "MyParameter", { ... })
Michael Wolfenden
03/29/2021, 11:59 PMArgument of type 'this' is not assignable to parameter of type 'Construct'.
Type 'MyStack' is not assignable to type 'Construct'.
Property 'onValidate' is protected but type 'Construct' is not a class derived from 'Construct'.ts(2345)
Michael Wolfenden
03/30/2021, 12:01 AM"devDependencies": {
"@aws-cdk/assert": "1.95.1",
"@aws-cdk/aws-ssm": "1.95.1",
"@types/aws-lambda": "^8.10.73"
},
"dependencies": {
"@aws-cdk/core": "1.95.1",
"@serverless-stack/cli": "0.10.6",
"@serverless-stack/resources": "0.10.6"
}
Frank
Frank
Frank
new ssm.StringParameter(this, "Param", {
stringValue: 'Foo',
});
Michael Wolfenden
03/30/2021, 5:10 AM1.94.1
works, 1.95.1
doesn'tFrank
Frank
add-cdk
command to add cdk dependencies, ie.
$ npx sst add-cdk @aws-cdk/aws-ssm
SST will install the supported version and updates your package.json
Ross Coundon
03/30/2021, 9:00 PMFrank
Frank
Ross Coundon
03/30/2021, 9:10 PMMismatched versions of AWS CDK packages. Serverless Stack currently supports 1.94.1. Fix using:
npm install @aws-cdk/aws-iam@1.94.1 @aws-cdk/core@1.94.1 --save-exact
However, 1.94.1 is the actual version in package jsonFrank
Frank
package.json
, loop through each dependency and dev dependency that starts with “@aws-sdk” and check if version is not, in this case, 1.94.1Frank
npm install @aws-cdk/aws-iam@1.94.1 @aws-cdk/core@1.94.1 --save-exact
?Ross Coundon
03/30/2021, 9:18 PMRoss Coundon
03/30/2021, 9:19 PMnpx sst add-cdk @aws-cdk/aws-ssm
Frank
Ross Coundon
03/30/2021, 9:19 PMFrank