-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make it possible to get extra args provided to functional handlers #409
Conversation
packages/restate-sdk/src/context.ts
Outdated
/** | ||
* Extra arguments provided to the request handler: | ||
* Lambda: [Context] | ||
* Cloudflare workers: [Env, ExecutionContext] | ||
* Deno: [ConnInfo] | ||
* Bun: [Server] | ||
*/ | ||
readonly extraArgs: unknown[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's probably something to say here about determinism. People should be extra careful about those arguments, and really consume them only within ctx.run
.
Perhaps we should rather think about exposing them only within the run
closure (e.g. as optional argument of the run closure itself.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree, although it applies to many fields in this struct (eg body, attemptHeaders)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
body
is deterministic, headers
too. attemptHeaders
though is indeed not deterministic...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not possible to consume via a run.
It actually carries things that aren’t seirlazable, like clients to an object store etc’
I think that it needs to be clear, what that argument is, and a warning about determinism.
also the name should probably include that.
p.s, can it not be an array?
Can it be just unknown?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@igalshilman why just unknown given it is always an array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
https://discord.com/channels/1128210118216007792/1136316066696532069/1268606950833127454