You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling the client.pubsub.publish function for a class, Dapr should send a CloudEvent with the data field filled with the value passed to the function. A type conversion could be done so that the value is sent correctly. For example, JavaScript's Object.assign could be used.
If this option is not possible, the Dapr sdk function should return a response with the error field filled with a message describing the error.
Actual Behavior
When calling the client.pubsub.publish function for a class, Dapr sends a CloudEvent with the data field empty. The data_base64 field is filled with the value [object Object], which does not describe the real object that should be sent.
Steps to Reproduce the Problem
Create a class with the data you want to be sent by Dapr
Check the contents of the event received by Dapr. One possibility is to use a Dapr subscriber receiving the events in JSON format instead of CloudEvent:
constexpress=require('express');constbodyParser=require('body-parser');constapp=express();constport=3000;app.use(bodyParser.json({type: 'application/*+json'}));// Subscribe to topicapp.get('/dapr/subscribe',(_req,res)=>{res.json([{pubsubname: "pubsub",topic: "topic",route: "route"}]);});// Handle incoming eventsapp.post('/route',(req,res)=>{console.log(req.body);res.sendStatus(200);});app.listen(port,()=>console.log(`Node App listening on port ${port}!`));
The received event will be something like:
(Note there is no data field, but data_base64)
Decoding the value of data_base64 using base64, the value will be literally [object Object], which does not describe the real object that should have been sent.
Extra: Convert data before sending the event and check the contents of the event received by Dapr:
// ...constresponse=awaitclient.pubsub.publish(pubSubId,topic,Object.assign({},data));// Object.assign was used to convert the type ^^^^^^^^^^^^^^^^^^^^^^^console.log("Response: ",response);// Response: {}
The received event will be something like:
(Note that the data field is filled correctly)
Edit:
Node Version: 14.17.0
Updating Node to v18.16.0 makes this error related to "node:stream" no longer happen.
But the problem reported in this issue persists using Dapr SDK 3.2.0
This issue has been automatically marked as stale because it has not had activity in the last 60 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.
Expected Behavior
When calling the
client.pubsub.publish
function for a class, Dapr should send a CloudEvent with thedata
field filled with the value passed to the function. A type conversion could be done so that the value is sent correctly. For example, JavaScript'sObject.assign
could be used.If this option is not possible, the Dapr sdk function should return a response with the
error
field filled with a message describing the error.Actual Behavior
When calling the
client.pubsub.publish
function for a class, Dapr sends a CloudEvent with thedata
field empty. Thedata_base64
field is filled with the value[object Object]
, which does not describe the real object that should be sent.Steps to Reproduce the Problem
The received event will be something like:
(Note there is no
data
field, butdata_base64
)Decoding the value of
data_base64
using base64, the value will be literally[object Object]
, which does not describe the real object that should have been sent.data
before sending the event and check the contents of the event received by Dapr:The received event will be something like:
(Note that the
data
field is filled correctly)The text was updated successfully, but these errors were encountered: