Error calling publish_event with rawPayload metadata
See original GitHub issueExpected Behavior
Using the Python sample from the documentation to publish messages to a MQTT pub/sub binding with rawPayload=true :
from dapr.clients import DaprClient
with DaprClient() as d:
req_data = {
'order-number': '345'
}
# Create a typed message with content type and body
resp = d.publish_event(
pubsub_name='pubsub',
topic='TOPIC_A',
data=json.dumps(req_data),
metadata=(
('rawPayload', 'true')
)
)
# Print the request
print(req_data, flush=True)
Actual Behavior
The following error occurs and the data is not published:
== APP == resp = d.publish_event(
== APP == File "/home/vscode/.local/lib/python3.8/site-packages/dapr/clients/grpc/client.py", line 350, in publish_event
== APP == _, call = self._stub.PublishEvent.with_call(req, metadata=metadata)
== APP == File "/home/vscode/.local/lib/python3.8/site-packages/grpc/_channel.py", line 955, in with_call
== APP == state, call, = self._blocking(request, timeout, metadata, credentials,
== APP == File "/home/vscode/.local/lib/python3.8/site-packages/grpc/_channel.py", line 926, in _blocking
== APP == call = self._channel.segregated_call(
== APP == File "src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi", line 498, in grpc._cython.cygrpc.Channel.segregated_call
== APP == File "src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi", line 366, in grpc._cython.cygrpc._segregated_call
== APP == File "src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi", line 360, in grpc._cython.cygrpc._segregated_call
== APP == File "src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi", line 218, in grpc._cython.cygrpc._call
== APP == File "src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi", line 246, in grpc._cython.cygrpc._call
== APP == File "src/python/grpcio/grpc/_cython/_cygrpc/channel.pyx.pxi", line 89, in grpc._cython.cygrpc._operate
== APP == File "src/python/grpcio/grpc/_cython/_cygrpc/tag.pyx.pxi", line 64, in grpc._cython.cygrpc._BatchOperationTag.prepare
== APP == File "src/python/grpcio/grpc/_cython/_cygrpc/operation.pyx.pxi", line 37, in grpc._cython.cygrpc.SendInitialMetadataOperation.c
== APP == File "src/python/grpcio/grpc/_cython/_cygrpc/metadata.pyx.pxi", line 41, in grpc._cython.cygrpc._store_c_metadata
== APP == ValueError: too many values to unpack (expected 2)
Checking the source code at client.py the rawPayload
metadata probably needs to be assigned to the metadata of the PublishEventRequest, which is not implemented.
content_type = ""
if data_content_type:
content_type = data_content_type
req = api_v1.PublishEventRequest(
pubsub_name=pubsub_name,
topic=topic_name,
data=req_data,
data_content_type=content_type)
# response is google.protobuf.Empty
_, call = self._stub.PublishEvent.with_call(req, metadata=metadata)
Steps to Reproduce the Problem
Run the sample code from the documentation. In the sample there is another small issue, that the parameter topic
needs to be renamed to topic_name
.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
Client
func NewClient() (client Client, err error) ... can be passed as option to PublishEvent to set rawPayload metadata.
Read more >Pub/sub API reference
Metadata can be sent via query parameters in the request's URL. ... rawPayload, Boolean to determine if Dapr should publish the event ...
Read more >The Skill Tester - Using Oracle Digital Assistant
These test cases are part of the skill's metadata and therefore persist ... Recording conversations is quicker and less error prone than ...
Read more >Error trying to get metadata from url stream using java ...
I don't know this library and how FFmpegMediaMetadataRetriever#extractMetadata works. I suspect that the second call to mmr.
Read more >HTMLMediaElement: loadedmetadata event - Web APIs | MDN
These examples add an event listener for the HTMLMediaElement's loadedmetadata event, then post a message when that event handler has ...
Read more >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 FreeTop 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
Top GitHub Comments
v1.4.1 pushed, and docs fixed.
Fix merged. This is a bad enough bug it warrants an out of band patch release. Will cut that shortly.