-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add options to invocation context #54
Conversation
@@ -53,6 +54,7 @@ export class InvocationModel implements coreTypes.InvocationModel { | |||
retryContext: fromRpcRetryContext(req.retryContext), | |||
traceContext: fromRpcTraceContext(req.traceContext), | |||
triggerMetadata: fromRpcTriggerMetadata(req.triggerMetadata, this.#triggerType), | |||
options: fromRpcBindings(this.#bindings), |
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.
My biggest issue with this implementation is that this now requires the options
as input to the constuctor of InvocationContext
, making the unit testing scenario harder. This code you have in the Wiki here would no longer work:
const testInvocationContext = new InvocationContext({
functionName: 'testFunctionName',
invocationId: 'testInvocationId',
logHandler: (_level, ...args) => console.log(...args)
});
Is there a way around this? Could we have the options object initialized inside the constructor, or set here after the context = new InvocationContext({})
line?
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.
I assume this feedback applies to all properties on InvocationContextInit
? I've updated so in testing scenarios you can just do new InvocationContext()
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.
That's great! Yeah, I was gonna suggest that too but in a separate PR 😛
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! Can we get a release of the library with these change so I can ingest it and make the necessary change on the SDK side?
@@ -53,6 +54,7 @@ export class InvocationModel implements coreTypes.InvocationModel { | |||
retryContext: fromRpcRetryContext(req.retryContext), | |||
traceContext: fromRpcTraceContext(req.traceContext), | |||
triggerMetadata: fromRpcTriggerMetadata(req.triggerMetadata, this.#triggerType), | |||
options: fromRpcBindings(this.#bindings), |
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.
That's great! Yeah, I was gonna suggest that too but in a separate PR 😛
Fixes #52
The main goal is just to give people an easy way to inspect the configuration they used to register the function at the time of invocation.