Could you provide an example of CloudEventDataConverterAttribute
See original GitHub issueI have the below simple event function:
open Google.Cloud.Functions.Framework
open Google.Events
open Google.Events.Protobuf.Cloud.PubSub.V1
open System.Threading.Tasks
type Function() =
interface ICloudEventFunction<PubsubMessage> with
member this.HandleAsync(cloudEvent, data, cancellationToken) =
printfn "%s" data.TextData
Task.CompletedTask
When deployed I get the error:
System.InvalidOperationException: Unable to create data converter for target type Google.Events.Protobuf.Cloud.PubSub.V1.PubsubMessage
---> System.ArgumentException: Type Google.Events.Protobuf.Cloud.PubSub.V1.PubsubMessage does not have CloudEventDataConverterAttribute applied to it.
at Google.Events.CloudEventConverters.CreateDataConverter[T]()
--- End of inner exception stack trace ---
at Google.Events.CloudEventConverters.CreateDataConverter[T]()
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at Google.Events.CloudEventConverters.GetDataConverter[T]()
at Google.Events.CloudEventConverters.ConvertCloudEventData[T](CloudEvent cloudEvent)
at Google.Cloud.Functions.Framework.CloudEventAdapter`1.HandleAsync(HttpContext context)
at Google.Cloud.Functions.Hosting.HostingInternals.Execute(HttpContext context)
at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
The README says the type in the ICloudEventFunction
should have the CloudEventDataConverterAttribute
applied to it but I would have thought GCP types would already have this?
Could you give an example of how to apply CloudEventDataConverterAttribute
to types?
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@vestigialdev: Yup - sorry for taking too long to work out that’s what you meant. (First coffee of the day hadn’t fully kicked in.)
It turns out there were issues with some other snippets too. I’m fixing those up, and also trying to work out why this wasn’t caught in automated testing. Thanks for spotting it and drawing my attention to it.
Sorry for being unclear- I do mean that the template generated by the Cloud Console (rather than using powershell locally to run dotnet new gcf-event) seems to output a bad Function.cs that doesn’t compile/deploy