Searching through stackoverflow and other google resources wasn't helping and thought this repo might be a good place to ask my question.
*EDIT*: I created a stackoverflow question for this - https://stackoverflow.com/questions/49696913/google-pubsub-subscriber-that-does-a-http-push-to-a-cloud-function-in-same-proj. While writing up my question I did find this link - https://stackoverflow.com/questions/44920403/gcp-verify-ownership-of-a-cloud-function-https-endpoint-for-a-pubsub-push. Just not sure if that's the reason why my situation isn't working.
Curent question:
Is it possible to setup a pubsub topic/subscriber in one project that does a http PUSH to a cloud function in the same OR in another google project? I know there are PubSub triggers but these do not work when the pubsub topic is in another google project.
Error I get is pubsub error INVALID_ARGUMENT if I try to create it. I wasn't sure if this was because I needed to register the endpoint (https://cloud.google.com/pubsub/docs/push#other-endpoints). However that didn't feel right because when I create a function, the URL is given to me automatically and I can hit it via Postman.
Thoughts? Did I miss some documentation somewhere?
Thanks!
You need to verify this URL by going on your Google Cloud Console, API & Services, Credentials, then the Domain Verification tab. Add the url of your Cloud Functions. You will need to do that for each and every one.
Then, make sure that in the Search Console, you select the META TAG verification method, and response with that on GET requests.
if (req.method === 'GET') {
// mine is in a settings file but you can hardcode yours for testing purposes
return res.send(`<html><head><meta name="google-site-verification" content="${settings.google.siteVerificationCode}" /></head><body></body></html>`)
}
@lazharichir Is your solution still working?
I'm getting the same error after i verified the function domain
@lazharichir Is your solution still working?
I'm getting the same error after i verified the function domain
Yes, I did it for a new pubsub and GCF yesterday or two days ago and it worked (verify the domain on Search Console, then add to the GCP Domain verification list, and then I can push).
Make sure you use the GCF url with a slash at the end when you create the PUSH subscription as https://.../name-of-function/
https://.../name-of-function/
That was the issue thank you! @lazharichir
@lazharichir - The solution worked for me. I was wondering if there is a way to automate this step. I see a gcloud domain verify but not for the URL though. I was looking for a automated way (as part of CICD) of creating the Cloud function, domain verification and pub sub subscription
Most helpful comment
You need to verify this URL by going on your Google Cloud Console,
API & Services,Credentials, then theDomain Verificationtab. Add the url of your Cloud Functions. You will need to do that for each and every one.Then, make sure that in the Search Console, you select the META TAG verification method, and response with that on
GETrequests.