I’m doing migration from 0.55 to 1.0.0… Can I sti...
# sst
a
I’m doing migration from 0.55 to 1.0.0… Can I still use classes? or I need to migrate all my classes into functions?
@thdxr help. 😂
t
you can still use classes!
a
Is there any example?
Because my
super()
is failing now
Not sure how to migrate the classes into a new class.
t
Hm that's probably unrelated to class vs functional
Nothing should change there
Are you sure you updated aws-cdk-lib? Also wipe node modules
a
Looks like is expecting Construct?
The new signature is:
Copy code
constructor(scope: Construct, id: string, props?: StackProps);
In the Stack class?
Any idea?
a
Uhh.. My
scope
parameters are still
<http://sst.App|sst.App>
in v1
a
Mmm.
I’m using this:
Copy code
"@serverless-stack/cli": "^1.1.1",
    "@serverless-stack/resources": "^1.1.1",
Just did a fresh install.
Are you too @Adam Fanello?
a
I'm still on v1.0.4.
a
Ah, maybe that changed after.
a
Code snippet:
Copy code
import * as sst from "@serverless-stack/resources";
import { Stack, StackProps } from "@serverless-stack/resources";
import { RemovalPolicy } from "aws-cdk-lib";
import { Bucket, BucketEncryption } from "aws-cdk-lib/aws-s3";
import { Table } from "aws-cdk-lib/aws-dynamodb";
import DynamoDBTable from "./dynamodb-table.construct";

export interface DataStackProps extends StackProps {
  isEphemeralStage: boolean;
}

/**
 * Stack to hold persistent data:
 * - DynamoDB table(s)
 * - Data Lake
 */
export default class DataStack extends Stack {
  public readonly primaryTable: Table;
  public readonly dataLakeBucket: Bucket;

  constructor(scope: <http://sst.App|sst.App>, id: string, props: DataStackProps) {
    super(scope, id, props);
a
I have to do a migration from
0.x
, so planning to migrate to the latest.
a
Oh of course. Things move fast here. I'm behind because I haven't updated in a week!
a
Yeah.
Also, I don’t like functional stacks, haha, trying to stick with OOP, but can’t find a guide to migrate it.
a
Yup, I'm still using class too. (Wouldn't call it OOP , just classes.)
a
True.
This is weird, I don’t see this version in github.
Maybe is moving too fast, hahaha.
But also, I don’t see any notice of breaking changes.
f
Hey @Adrián Mouly just check if you are still the issue. v0.55 is quite old. Can you try updating to v0.59.0 first? We made the CDK v1 to v2 update with a few breaking changes.
Might also worth trying: • pin
@serverless-stack
packages to
0.59.0
without the caret
^
for now • remove
node_modules
and lock file • install dependencies again • build
fyi type
Construct
is a CDK v2 idea, so let’s make sure we update to
0.59.0
first.
d
Construct is fragile. The jump to 10.1.x from 10.0.x can create the errors above. (I was just fighting with this surprise, on a build that had no SST/CDK changes)
Maybe remove
Construct
from your package.json? If it’s there?