-
Notifications
You must be signed in to change notification settings - Fork 174
Closed
Description
Hi everyone,
I've been trying to mock a pub/sub event on my local dev according to the docs at https://github.com/GoogleCloudPlatform/functions-framework-nodejs/tree/master/docs#local-testing-of-cloud-events. Nothing special, I'm just trying to manipulate the data object passed as a parameter to the function (which I assume should be unmarshalled, given that I'm starting the server with --signature-type=event).
Function code:
exports.helloPubSub = (data, context) => console.log(data);
Mock Json:
{
"message": {
"attributes": {
"key": "value"
},
"data": "SGVsbG8gQ2xvdWQgUHViL1N1YiEgSGVyZSBpcyBteSBtZXNzYWdlIQ==",
"messageId": "136969346945"
},
"subscription": "projects/myproject/subscriptions/mysubscription"
}
Output
{
'{ "message": { "attributes": { "key": "value" }, "data": "SGVsbG8gQ2xvdWQgUHViL1N1YiEgSGVyZSBpcyBteSBtZXNzYWdlIQ': '=", "messageId": "136969346945" }, "subscription": "projects/myproject/subscriptions/mysubscription"}'
All of the above is pretty standard. However, I can't get to parse the resulting object in any meaningful way.
Would you be able to shed some light on this issue?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels