Try creating a push subscription in Project B that is connected to a Pub/Sub topic from Project A. Set the Cloud Function’s trigger URL as the endpoint URL in the push subscription settings in Project B.