Hey team, what is the recommended way of importing...
# help
Hey team, what is the recommended way of importing stack outputs. Eg: Importing Dynamodb stack output (table name) and passing it to lambda env vars. Do we have a construct for simplifying this or a plan to do so?
Hey @Mr.9715, is the table created in another stack of the same SST app? If so, do you mean something like this:
Copy code
new sst.Function(this, "MyFunction", {
  handler: "lambda.main",
  environment: { tableName: table.tableName },
@Frank, this is what I am using right now, this works fine but complicates the unit testing (I am still a noob in writing useful efficient unit tests). But I will have a separate app. (let say admin portal as well, where I will need to import stack output) Also, does SST have plans to cover a little bit of unit testing? I read the doc with CDK, (snapshots and Fine-grained assertions). I was trying to have a unit test that eg. validates dynamodb schema or no. of indexes. (still not sure if we do need to test all these in such depths.)
This is the unit tests for the `sst.Table` construct. You can do something similar i’m thinking, creating an instance of ur stack, and validates the CF Template CDK generates.
Oh, this is really good! Thanks.
@Frank, We should add a reference to this (page/link) in the documentation or guide. Extremely useful and will be used as refs when writing our own.
@Jay I agree with @Mr.9715. We spent quite a bit of effort to structure our unit tests. We should share how we are doing it and have some examples in the Testing your app doc.
Let me open an issue for this.
Yup yup