Hi Sam, are you able to explain a little further as to what Node-specific tricks are used for this? Given the release of the python functions framework (
https://github.com/GoogleCloudPlatform/functions-framework-python ) I was digging into how Node registers emulated functions with the firestore emulator to see what would be needed to do this from python.
(apologies, my background is Python, my Node knowledge is limited).
From what I can see
FunctionsEmulator.addFirestoreTrigger does a JSON PUT of the bundle to
http://localhost:${firestorePort}/emulator/v1/projects/${projectId}/triggers/${definition.name}
where the bundle (for project id myproject) is
{'eventTrigger': {'resource': 'projects/myproject/databases/(default)/documents/messages/{documentId}',
'eventType': 'providers/cloud.firestore/eventTypes/document.create',
'service': 'firestore.googleapis.com'}} This makes the firestore emulator do a HTTP POST to port 5001 on firestore document create.
I've tried to imitate this by:
1) running the java emulator manually with the same argument as per firebase emulators:start --only functions,firestore:
java -Duser.language=en -jar /home/johnc/.cache/firebase/emulators/cloud-firestore-emulator-v1.10.2.jar --host localhost --port 8080 --rules /home/johnc/Projects/myproject/firestore.rules --functions_emulator localhost:5001 --webchannel_port 8081
2) then running a local python function with:
functions-framework --signature_type event --debug true --target hello_event --port=5001
3) setting up the trigger with a PUT as per above (which returns 200).
Any suggestions of what I might be missing?