Skip to content
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

Merged
merged 3 commits into from
Aug 3, 2024

Conversation

jackkleeman
Copy link
Contributor

Copy link

github-actions bot commented Aug 2, 2024

Test Results

102 files  ±0  102 suites  ±0   23m 11s ⏱️ +43s
 84 tests ±0   84 ✅ ±0  0 💤 ±0  0 ❌ ±0 
217 runs  +2  217 ✅ +2  0 💤 ±0  0 ❌ ±0 

Results for commit f463fb6. ± Comparison against base commit 451e796.

Comment on lines 59 to 66
/**
* Extra arguments provided to the request handler:
* Lambda: [Context]
* Cloudflare workers: [Env, ExecutionContext]
* Deno: [ConnInfo]
* Bun: [Server]
*/
readonly extraArgs: unknown[];
Copy link
Contributor

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.)

Copy link
Contributor Author

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)

Copy link
Contributor

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...

Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Contributor

@igalshilman igalshilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@jackkleeman jackkleeman merged commit 1750275 into main Aug 3, 2024
2 checks passed
@jackkleeman jackkleeman deleted the extra-args branch August 3, 2024 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants