-
Notifications
You must be signed in to change notification settings - Fork 123
Description
Hello,
I am trying to emulate the behavior of my application.
To do so I use the Pub/Sub Emulator and the Google cloud function emulator.
The cloud function I created looks like the image following and is supposed to be triggered by an event :

Both emulators are communicating without issue.
I followed the example of this repository: https://github.com/GoogleCloudPlatform/functions-framework-nodejs to link them.
When, following the example, I use this command line:
curl -d "@mockPubsub.json" -X POST
-H "Ce-Type: true"
-H "Ce-Specversion: true"
-H "Ce-Source: true"
-H "Ce-Id: true"
-H "Content-Type: application/json"
http://localhost:8080
On my Cloud function emulator I do receive this :

So this is exactly what I want.
Yet, I do not want to use the command line to send messages but I want the cloud function to be triggered by a Pub/Sub event.
Here you can see the methods creating:
I. a pull subscription
II. a push subsciption
III. publishing messages
However When I want to publish messages, the Pub/Sub emulator detect the connection:
[pubsub] INFO: Detected HTTP/2 connection.
But then the Cloud Function emulator does not receive the data, although it detects an event occurred:

I think it is probably because POSTING to a Gcloud Function needs some headers with the 'Ce-' prefix.
But searching a bit on how to add headers to my push subscriber I found out this wasn't possible.
It's possible I totally missed something...
I hope this is understandable.
Thank you
