There is no way to connect a cloud function with a PubSub in a different project:
Note: The Cloud Pub/Sub topic that your function is subscribed to must be in the same Google Cloud Platform project as your Cloud Function.
There is a way to use HTTP-triggered subscription to invoke a cloud function:
Note: You can also use HTTP-triggered functions to listen to Pub/Sub push subscriptions. This allows a single Cloud Function to subscribe to multiple topics.
However when trying to create an HTTP-triggered subscription an error occurs:
PubSub push subscription error: The supplied HTTP URL is not registered in the project that owns the subscription
There is no way to connect a cloud function with a PubSub in a different project:
There is a way to use HTTP-triggered subscription to invoke a cloud function:
However when trying to create an HTTP-triggered subscription an error occurs:
It seems there is a need to register the endpoint: https://cloud.google.com/pubsub/docs/push#other-endpoints
This task is to follow the registration flow and see how simple/hard it is.