Repository navigation
Add Cloud Events support for #55 - #56
Conversation
…o be run from anywhere and enables IDE debugger
I will squash a bunch of these interim commits before submitting the PR. DO NOT SUBMIT
…e error handling. Please see all the TODO questions before I finish off this PR. DO NOT SUBMIT
|
FYI @cumason123 |
There was a problem hiding this comment.
Thanks for the PR @joelgerard! I like the tests and think this is close to mergeable.
I added a detailed review.
There are a couple scenarios we're in that make it tricky, that we faced. Hope this will give background:
- The CloudEvents SDK is pretty clunky and not ideal. It looks like we've been able to use it here though.
- The legacy (
event) signature (elif signature_type == "event":) and_event_view_func_wrapperis pretty wrong as GCF legacy events are not CloudEvents and are a separate payload type.- I don't think the
_is_binary_cloud_eventcodepath is touched. We should remove allcloudeventparsing logic from theeventsignature.
- I don't think the
roffjulie
left a comment
There was a problem hiding this comment.
This is a good starting point, but it misses one of the key points of the CloudEvent proposal, which is that the function signature containing a CloudEvent has a different signature type.
In brief, there are three types of function signatures: http, which is the function that handles an HTTP request directly, event, which is the function that accepts legacy events parsed by the framework into (data, context) parameters, and cloudevent, which is the function that accepts CloudEvents parsed by the framework into an event as defined by the CloudEvents SDK. See the framework contract (https://github.com/GoogleCloudPlatform/functions-framework#supported-function-types) for more depth, but that's the broad summary.
It'd be great if this could be reworked to introduce the cloudevent signature type as a separate type from the existing legacy event type.
di
left a comment
There was a problem hiding this comment.
Thanks for working on this @joelgerard!
…ons DO NOT return a custom value. General tidy-up. Support binary functions.
Co-authored-by: Dustin Ingram <di@users.noreply.github.com>
Co-authored-by: Dustin Ingram <di@users.noreply.github.com>
Co-authored-by: Dustin Ingram <di@users.noreply.github.com>
Co-authored-by: Dustin Ingram <di@users.noreply.github.com>
Co-authored-by: Dustin Ingram <di@users.noreply.github.com>
Co-authored-by: Dustin Ingram <di@users.noreply.github.com>
Co-authored-by: Dustin Ingram <di@users.noreply.github.com>
Co-authored-by: Dustin Ingram <di@users.noreply.github.com>
Co-authored-by: Dustin Ingram <di@users.noreply.github.com>
Co-authored-by: Dustin Ingram <di@users.noreply.github.com>
Co-authored-by: Dustin Ingram <di@users.noreply.github.com>
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
nit: Here and in the main README there >1 blank lines in the file. Remove these extra blank lines.
| class _EventType(enum.Enum): | ||
| LEGACY = 1 | ||
| CLOUDEVENT_BINARY = 2 | ||
| CLOUDEVENT_TEXT = 3 |
There was a problem hiding this comment.
As mentioned before, CloudEvent Text is not an event type.
The logic used here is for a CloudEvent Structured event.
This is the spec: https://github.com/cloudevents/spec/blob/master/http-protocol-binding.md#32-structured-content-mode
CLOUDEVENT_TEXT should be CLOUDEVENT_STRUCTURED.
| function(event) | ||
|
|
||
|
|
||
| def _run_text_cloudevent(function, request, cloudevent_def): |
There was a problem hiding this comment.
Should be _run_structured_cloudevent.
commented
Jun 19, 2020
|
Cool, looks like we're all good/approved. :) |
Adds support for Cloud Events per #55.