Closed eladb closed 3 months ago
@eladb I'm curious if using composition is a workaround for your use case? (trying to understand priority of this)
Hi,
This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!
I believe this now works. CC: @eladb, @Chriscbr
Thanks for the heads up @staycoolcall911. It looks like the immediate bug above was fixed (I think via https://github.com/winglang/wing/pull/4640), but if I extend the example a little further with some inflight code, we still get errors:
bring "cdk8s" as cdk8s;
bring cloud;
let global_b = new cloud.Bucket();
class MyChart extends cdk8s.Chart {
local_b: cloud.Bucket;
init() {
new cdk8s.ApiObject(kind: "Pod", apiVersion: "v1");
this.local_b = new cloud.Bucket();
}
pub inflight save() {
global_b.put("data.txt", "Hello World!");
this.local_b.put("data.txt", "Hello World!");
}
}
let c = new MyChart();
new cloud.Function(inflight () => {
c.save();
});
error:
ERROR: unable to serialize immutable data object of type MyChart
target/main.wsim.988477.tmp/.wing/preflight.js:79
_registerOnLift(host, ops) {
if (ops.includes("handle")) {
>> $Closure1._registerOnLiftObject(c, host, ["save"]);
}
super._registerOnLift(host, ops);
I think the root cause is our lifting system is still assuming std.Resource
is in the class's hierarchy. Refactoring the SDK to remove std.Resource
feels like the cleanest solution IMO
Hi,
This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!
From my testing it looks like the previous example now works. I was able to uncover a separate issue but it's more minor: https://github.com/winglang/wing/issues/6629
Closing.
I tried this:
This happened:
I expected this:
To work
Is there a workaround?
No response
Component
Compiler, SDK
Wing Version
No response
Node.js Version
No response
Platform(s)
No response
Anything else?
No response
Community Notes