3

I'm new to Google Cloud Functions and reCAPTCHA. I've built my site using AngularJS and Express.js for the back-end. I've used express-recaptcha v5.0.1 for the Express.js.

I've tested the reCAPTCHA (both front-end and back-end) and it works fine when I run locally.

But when I deploy the back-end, I'm getting the following error from Google Cloud Functions:

Error: getaddrinfo EAI_AGAIN www.google.com:443
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26)

Is reCAPTCHA verify method blocked by the free plan of Google Cloud Functions?

This S/O seems to indicate that should be fine: Do I need a paid plan for using recaptcha on firebase function?

How can I debug this further?

Onema
  • 7,331
  • 12
  • 66
  • 102
Ben Amiot
  • 120
  • 8
  • 1
    My answer over there is suggesting that a specific hostname is required to make this work. What you're showing is that some bit of code is trying to access www.google.com, instead of the approved recaptcha.google.com – Doug Stevenson Oct 01 '19 at 13:11
  • According to this page: https://developers.google.com/recaptcha/docs/verify#api_request the URL is `https://www.google.com/recaptcha/api/siteverify` with a POST. – Ben Amiot Oct 01 '19 at 13:39
  • 1
    If things don't work the way you expect, please file an issue with Firebase support. https://support.google.com/firebase/contact/support – Doug Stevenson Oct 01 '19 at 13:40

1 Answers1

4

After raising a support case with Firebase team, it turned out that the only way to get the API to work is to use this URL https://recaptcha.google.com/recaptcha/api/siteverify as Doug mentioned in the comment.

So I will have to write my own module/middleware to do the verification to get it to work on the "free" Firebase tier.

Ben Amiot
  • 120
  • 8