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

Michael Robellard

05/25/2022, 9:10 PM
I think I am getting close: but I am still having some issues: npx sst build is running now, so that's good. When I run npx sst start, I get a whole lot of error output between: =============== Deploying app =============== and Deploying Stacks. It ends with a few errors which are clearly from my code, The ton of messages before that are all in node_modules: I am guessing that these are all configuration errors and have to do with changes between 0.69.0 and 1.2.4 since everything worked fine on 1.2.4
Copy code
Cannot find global type 'Array'.

Cannot find global type 'Boolean'.

Cannot find global type 'CallableFunction'.

Cannot find global type 'Function'.

Cannot find global type 'IArguments'.

Cannot find global type 'NewableFunction'.

Cannot find global type 'Number'.

Cannot find global type 'RegExp'.

Cannot find global type 'String'.

Library 'es2021' specified in compilerOptions

...

/Users/dramus/chartflow/stacks/dynamodb.js (21,13): Object literal may only specify known properties, and 'timeToLiveAttribute' does not exist in type 'TableProps'.
19.       },
20.       timeToLiveAttribute: "expires_at",
21.       stream: true,

/Users/dramus/chartflow/stacks/dynamodb.js (72,21): Object literal may only specify known properties, and 'replicationRegions' does not exist in type '{ table?: any; }'.
70.         cdk: {
71.           replicationRegions: replicationRegions,
72.         }

/Users/dramus/chartflow/stacks/dynamodb.js (80,15): Object literal may only specify known properties, and 'dynamodbtable' does not exist in type 'TableProps'.
78.       this.globalchartflowdata = new sst.Table(this, "Table", {
79.        dynamodbtable: dynamodb.Table.fromTableArn(this, "ImportedTable", tableArn),
80.       });

/Users/dramus/chartflow/stacks/index.js (15,13): Property 'push' does not exist on type '{}'.
13.  if(app.stage.startsWith("dev")){
14.   regions.push("ap-southeast-1");
15.  }

/Users/dramus/chartflow/stacks/s3.js (23,21): Object literal may only specify known properties, and 'publicReadAccess' does not exist in type '{ bucket?: BucketProps | Bucket; }'.
21.         cdk: {
22.           publicReadAccess: true
23.         }
Deploying stacks
r

Ross Coundon

05/25/2022, 9:21 PM
The standard way to access the underlying CDK construct from within an SST construct is using the cdk property. E.g.
Copy code
cdk: {
  table: {
    
  }
}
So you’d need to do:
Copy code
this.globalchartflowdata = new sst.Table(this, "Table", {
  cdk: {
    table: dynamodb.Table.fromTableArn(this, "ImportedTable", tableArn),
  }
}
Re the replicationRegions error, it should be:
Copy code
cdk: {
  table: {
    replicationRegions: replicationRegions,
  }
}
m

Michael Robellard

05/25/2022, 9:27 PM
Fixed those two, it seems like they moved a lot of stuff around, I think that is the majority of my issues. Are all these other messages normal that I am seeing that aren't from my code, or is some other setting somewhere wrong?
The TimeToLiveAttribute I was able to fix by moving it into cdk: { table: { as well
And changing public read access to cdk: { bucket :{ fixed that one as well. Not sure why I misread the migration instructions
r

Ross Coundon

05/25/2022, 9:31 PM
Cool, not sure about the others, could be related to the ESM changes that the team were working on. Maybe try updating to 1.2.7?
m

Michael Robellard

05/25/2022, 9:33 PM
Must have had to do with the fact that I was on that snapshot. 1.2.7 doesn't have that issue. Thanks for your help.
3 Views