export class UserDurableObject extends DurableObject {
env: WorkerEnv;
state: DurableObjectState;
userId: string;
constructor(ctx: DurableObjectState, env: WorkerEnv) {
super(ctx, env);
this.env = env;
this.state = ctx;
const durableObjectId = this.state.id;
const userIdFromDo = durableObjectId.name;
// Errors because within the DO the name is not defined?
if (!userIdFromDo ) {
throw Error("doName is undefined");
}
this.userId = userIdFromDo;
}
}
export class UserDurableObject extends DurableObject {
env: WorkerEnv;
state: DurableObjectState;
userId: string;
constructor(ctx: DurableObjectState, env: WorkerEnv) {
super(ctx, env);
this.env = env;
this.state = ctx;
const durableObjectId = this.state.id;
const userIdFromDo = durableObjectId.name;
// Errors because within the DO the name is not defined?
if (!userIdFromDo ) {
throw Error("doName is undefined");
}
this.userId = userIdFromDo;
}
}