cloudflare / cloudflare/actors

Actor this.identifier is not available during blockConcurrencyWhile

Open
#60 5 comments 0 reactions 1 assignee Claimed by @Brayden View on GitHub
question
Dominant language
TypeScript
Stars
422
Forks
28
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
The examples and documentation in the code mentions that `this.identifier` should be available (not default) during `blockConcurrencyWhile`, but currently it always is `default`

**To Reproduce**
In both cases, the identifier is `default`.
`whoami` works correctly.

```js
export class MyActor extends Actor {
constructor(ctx: DurableObjectState, env: Env) {
super(ctx, env);

this.ctx.blockConcurrencyWhile(async () => {
console.log('ID: ', this.identifier)
});
}

protected async onInit(): Promise {
super.onInit();
console.log('Actor initialized: ', this.identifier);
}

async whoami(): Promise {
return this.identifier;
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.