but typescript saying TS2345: Argument of type '{ ...
# help
a
but typescript saying TS2345: Argument of type '{ dynamodbTable: any; }' is not assignable to parameter of type 'TableProps'.<br/>Object literal may only specify known properties, and 'dynamodbTable' does not exist in type 'TableProps'.
f
Hey @Artem Kalantai Can you try this
Copy code
import * as dynamodb from "@aws-cdk/aws-dynamodb";

new sst.Table(this, "Dishes", {
  dynamodbTable: dynamodb.Table.fromTableArn(this, "ImportedDishes", "arn:aws:dynamodb:us-east-1:112233445566:table/dev-Dishes"),
});
a
sure I can, but the issue not in the name or arn, it is not Runtime problem, it is issue during compilation
so the constructor of the table has 3 arguments
Copy code
constructor(scope: cdk.Construct, id: string, props: TableProps)
the last one of the type TableProps
and TableProps is
Copy code
export interface TableProps {
  readonly fields: { [key: string]: TableFieldType };
  readonly primaryIndex: TableIndexProps;
  readonly secondaryIndexes?: { [key: string]: TableIndexProps };
}
so the are no field like
Copy code
dynamodbTable
that's why the compiler show the error and that's why I'm asking what I'm doing wrong, because this is in documentation
@Frank and thanks for you answer
f
hmm.. what’s the version of SST you are using?
a
Copy code
{
  "name": "dinenation-api",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "test": "sst test",
    "start": "sst start",
    "build": "sst build",
    "deploy": "sst deploy",
    "remove": "sst remove"
  },
  "devDependencies": {
    "@aws-cdk/assert": "1.91.0",
    "@types/aws-lambda": "^8.10.70",
    "@types/node-fetch": "^2.5.8"
  },
  "dependencies": {
    "@aws-cdk/aws-apigatewayv2-authorizers": "1.91.0",
    "@aws-cdk/aws-cognito": "1.91.0",
    "@aws-cdk/core": "1.91.0",
    "@serverless-stack/cli": "0.9.10",
    "@serverless-stack/resources": "0.9.10",
    "@types/uuid": "^8.3.0",
    "aws-sdk": "^2.853.0",
    "moment": "^2.29.1",
    "node-fetch": "^2.6.1",
    "uuid": "^3.3.2"
  }
}
f
ah yeah, can you try the latest version 0.9.16
Copy code
$ npm install --save --save-exact @serverless-stack/cli@0.9.16 @serverless-stack/resources@0.9.16
a
wow
cool, sure
f
The dynamodb option was put in recently
a
i seee, let me try
oooo great
now it works fine
thanks a lot, sst is the best actually
👍
f
Nice! Appreciate the kind words!
a
is it possible to donate to you?
ups, now I have few issues
so, maybe I should update other libraries too?
nevermind, fixed
f
Thanks man! If you would keep throwing issues/feedback at me.. that’d be s-u-p-e-r helpful! 😄
a
great, right now I'm using sst on small project, but if it goes good, I want to use it in a big one
f
Awesome!
a
@Frank how could it be, I'm using existed table
Copy code
const dishesTable = new sst.Table(this, "Dishes", {
  dynamodbTable: dynamodb.Table.fromTableArn(this, "ImportedDishes", "arn:aws:dynamodb:us-east-1:150977011093:table/dev-dinenation-api-Dishes"),
  ...dishesTableProps
});
but when I'm doing sst start I have
dev-dinenation-api-dynamo failed: dev-dinenation-api-Dishes already exists
I thought it is the way to avoid this issue
and I'm not sure about "sst start", "sst remove", so should I remove after each start?
aaaa it is import old table to new table, but still create new table
am I correct?
how can I connect it to existing table so I will not create new one?