GoogleCloudPlatform / functions-framework-dart

FaaS (Function as a service) framework for writing portable Dart functions
https://pub.dev/packages/functions_framework
Apache License 2.0
536 stars 54 forks source link

Support for Protobufs in CloudEvents #391

Closed diezep closed 1 year ago

diezep commented 1 year ago

I get this error when i trigger a cloud event in Cloud Run using application/protobuf as a event data content type

Bad request. Unsupported encoding "application/protobuf". Only "application/json" is supported. package:functions_framework/src/json_request_utils.dart 42 mustBeJson package:functions_framework/src/targets/cloud_event_targets.dart 90 _decodeBinary package:functions_framework/src/targets/cloud_event_targets.dart 66 _eventFromRequest package:functions_framework/src/targets/cloud_event_targets.dart 53 CloudEventWithContextFunctionTarget.handler package:functions_framework/src/run.dart 49 _forbiddenAssetMiddleware.<fn> package:functions_framework/src/logging.dart 171 cloudLoggingMiddleware.hostedLoggingMiddleware.<fn>.<fn> dart:async _CustomZone.runGuarded package:functions_framework/src/logging.dart 168 cloudLoggingMiddleware.hostedLoggingMiddleware

kevmoo commented 1 year ago

We have no wired up proto support. Is this necessary?

diezep commented 1 year ago

We have no wired up proto support. Is this necessary?

I think it is @kevmoo. The new events from Firestore to trigger changes directly without cloud audit are only available with proto.

kevmoo commented 1 year ago

Let me dig in there, @diezep !

kevmoo commented 1 year ago

@diezep – can you point me to documentation from cloud run about when/where/how to expect application/protobuf ?

diezep commented 1 year ago

@diezep – can you point me to documentation from cloud run about when/where/how to expect application/protobuf ?

To be honest, I already searched for that before and didn't find anything about it. Not even how to handle that type of content.

kevmoo commented 1 year ago

@diezep – see https://github.com/GoogleCloudPlatform/functions-framework-dart/tree/main/examples/protobuf_firestore ! 😄

(The readme was copy-pasted and not updated. Need to get on that!)