Skip to content

@callable decorator doesn't implement __unsafe_ensureInitialized() #1253

@dragonkhoi

Description

@dragonkhoi

onStart() only runs if ensureInitialized is called via Workflow RPC, WebSocket, Fetch, Alarm, wake up, etc. As listed in #1056 :

'In PartyServer, #ensureInitialized() guards were added to fetch(), alarm(), webSocketMessage(), webSocketClose(), and webSocketError(). But _workflow_handleCallback(), _workflow_broadcast(), and _workflow_updateState() are public methods on the Agent class that get called via native Cloudflare DO RPC — they bypass all of those guarded entry points."

Similarly, @callable RPC methods defined by user (eg me) run and onStart() hasn't run yet. Would it be possible to add ensureInitialized guard in callable as well? Currently, I have to put onStart at the top of every callable that needs it (eg SQL table to exist). I know in #1057 this was fixed for workflows specifically but callable is also a native Cloudflare DO RPC which bypasses the entry points.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions